]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/34094 (Undefined static data member in anonymous namespace can acquire...
authorJason Merrill <jason@redhat.com>
Tue, 12 Feb 2008 06:37:34 +0000 (01:37 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 12 Feb 2008 06:37:34 +0000 (01:37 -0500)
        PR c++/34094
        * decl2.c (cp_write_global_declarations): Don't write out static
        data members with DECL_IN_AGGR_P set.

        PR c++/33916
        * Revert:
        2006-10-17  Mark Mitchell  <mark@codesourcery.com>
        PR c++/29039
        * typeck2.c (build_functional_cast): Don't zero-initialize
        non-PODs; instead, call their constructors.

From-SVN: r132254

gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/cp/typeck2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/init/ctor8.C [deleted file]

index 408126bea3786f15070cfbb19ad583dc543f8743..8069b3f5d594f45eaf0012d721235dea6419ac40 100644 (file)
@@ -1,3 +1,16 @@
+2008-02-12  Jason Merrill  <jason@redhat.com>
+
+       PR c++/34094
+       * decl2.c (cp_write_global_declarations): Don't write out static 
+       data members with DECL_IN_AGGR_P set.
+
+       PR c++/33916
+       * Revert:
+       2006-10-17  Mark Mitchell  <mark@codesourcery.com>
+       PR c++/29039
+       * typeck2.c (build_functional_cast): Don't zero-initialize
+       non-PODs; instead, call their constructors.
+
 2008-02-05  Richard Guenther  <rguenther@suse.de>
 
        Backport from mainline:
index 131e2dcf7514dba69df3d1a6f90c81fb3cb23db2..0f1841f52c2bf1b89ffb8a610b6200f00a0949eb 100644 (file)
@@ -3280,7 +3280,9 @@ cp_finish_file (void)
       /* Static data members are just like namespace-scope globals.  */
       for (i = 0; VEC_iterate (tree, pending_statics, i, decl); ++i)
        {
-         if (var_finalized_p (decl) || DECL_REALLY_EXTERN (decl))
+         if (var_finalized_p (decl) || DECL_REALLY_EXTERN (decl)
+             /* Don't write it out if we haven't seen a definition.  */
+             || DECL_IN_AGGR_P (decl))
            continue;
          import_export_decl (decl);
          /* If this static data member is needed, provide it to the
index 9dcb47c80cc30f81f44b57695e651add0f5eedd9..9ab0c65e88bd827fad956dc309d52aaca644e01b 100644 (file)
@@ -1342,9 +1342,9 @@ build_functional_cast (tree exp, tree parms)
   if (parms && TREE_CHAIN (parms) == NULL_TREE)
     return build_c_cast (type, TREE_VALUE (parms));
 
-  /* We need to zero-initialize POD types.  */
-  if (parms == NULL_TREE 
-      && !CLASSTYPE_NON_POD_P (type)
+  /* We need to zero-initialize POD types.  Let's do that for everything
+     that doesn't need a constructor.  */
+  if (parms == NULL_TREE && !TYPE_NEEDS_CONSTRUCTING (type)
       && TYPE_HAS_DEFAULT_CONSTRUCTOR (type))
     {
       exp = build_zero_init (type, 
index 5a3e80602a1591834a54ac0d1b84d58e459aa1de..80029693115042bcc9f559edcd900a1685365487 100644 (file)
@@ -1,3 +1,7 @@
+2008-02-12  Jason Merrill  <jason@redhat.com>
+
+       * g++.dg/init/ctor8.C: Remove.
+
 2008-02-06  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
 
         * g++.dg/tree-ssa/ivopts-1.C: Remove xfails for hppa*-*-*.
diff --git a/gcc/testsuite/g++.dg/init/ctor8.C b/gcc/testsuite/g++.dg/init/ctor8.C
deleted file mode 100644 (file)
index 9723892..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-// PR c++/29039
-
-typedef struct S { // { dg-error "reference" }
-  int &r; 
-};
-
-S f () {
-  return S (); // { dg-error "synthesized" }
-}
-
-