PR c++/24302
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 11 Oct 2005 06:19:55 +0000 (06:19 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 11 Oct 2005 06:19:55 +0000 (06:19 +0000)
* toplev.c (check_global_declaration_1): Robustify.
PR c++/24302
* g++.dg/warn/Wunused-12.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@105222 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/Wunused-12.C [new file with mode: 0644]
gcc/toplev.c

index 390384b..9fa7f0d 100644 (file)
@@ -1,3 +1,9 @@
+2005-10-10  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/24277
+       * pt.c (instantiate_decl): Call finish_static_data_member_decl for
+       static data members.
+
 2005-10-10  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
            Mark Mitchell  <mark@codesourcery.com>
 
index 9e9dc6e..aa4a66f 100644 (file)
@@ -1,5 +1,8 @@
 2005-10-10  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/24302
+       * g++.dg/warn/Wunused-12.C: New test.
+
        PR c++/23437
        * g++.dg/template/arg4.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/warn/Wunused-12.C b/gcc/testsuite/g++.dg/warn/Wunused-12.C
new file mode 100644 (file)
index 0000000..51d2343
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/24302
+// { dg-options "-Wunused" }
+
+static union
+{
+  unsigned char FLT4ARR[4]; 
+  float FLT4;
+}; // { dg-warning "used" }
index 796c7bf..eea9ab2 100644 (file)
@@ -836,7 +836,7 @@ check_global_declaration_1 (tree decl)
       && ! TREE_USED (decl)
       /* The TREE_USED bit for file-scope decls is kept in the identifier,
         to handle multiple external decls in different scopes.  */
-      && ! TREE_USED (DECL_NAME (decl))
+      && ! (DECL_NAME (decl) && TREE_USED (DECL_NAME (decl)))
       && ! DECL_EXTERNAL (decl)
       && ! TREE_PUBLIC (decl)
       /* A volatile variable might be used in some non-obvious way.  */