]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/28559 (ICE with friend and __attribute__)
authorJason Merrill <jason@gcc.gnu.org>
Mon, 14 Aug 2006 21:25:03 +0000 (17:25 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 14 Aug 2006 21:25:03 +0000 (17:25 -0400)
        PR c++/28559
        * parser.c (cp_parser_elaborated_type_specifier): Also ignore
        attributes applied to a TYPENAME_TYPE.

From-SVN: r116137

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/g++.dg/ext/attrib25.C [new file with mode: 0644]

index 1106f86b0c77c2dbbaedff6c53f41217008f569f..5737a628211b6dcfb3847ff6a928f031a66c8040 100644 (file)
@@ -1,27 +1,33 @@
+2006-08-11  Jason Merrill  <jason@redhat.com>
+
+       PR c++/28559
+       * parser.c (cp_parser_elaborated_type_specifier): Also ignore
+       attributes applied to a TYPENAME_TYPE.
+
 2006-08-09  Lee Millward  <lee.millward@codesourcery.com>
 
-       PR c++/28637
-       * pt.c (coerce_template_parms): Copy across the
-       invalid template arguments to the new template inner arguments.
-       (retrieve_specialization): Robustify.
+       PR c++/28637
+       * pt.c (coerce_template_parms): Copy across the
+       invalid template arguments to the new template inner arguments.
+       (retrieve_specialization): Robustify.
 
-       PR c++/28638
-       * pt.c (coerce_template_template_parms): Robustify.
+       PR c++/28638
+       * pt.c (coerce_template_template_parms): Robustify.
 
-       PR c++/28639
-       * error.c (dump_template_parms): Robustify.
+       PR c++/28639
+       * error.c (dump_template_parms): Robustify.
 
-       PR c++/28640
-       * pt.c (redeclare_class_template): Robustify.
+       PR c++/28640
+       * pt.c (redeclare_class_template): Robustify.
 
-       PR c++/28641
-       * pt.c (type_unification_real): Robustify.
+       PR c++/28641
+       * pt.c (type_unification_real): Robustify.
        
 2006-08-03  Lee Millward  <lee.millward@codesourcery.com>
 
-       PR c++/28347
-       * decl.c (start_decl): Return error_mark_node if a
-       diagnostic was issed for an invalid typedef initialization.
+       PR c++/28347
+       * decl.c (start_decl): Return error_mark_node if a
+       diagnostic was issed for an invalid typedef initialization.
        
 2006-08-03  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
index aa297874f30fbe3b798ca06b3d70f876b8ae93b2..35ce410e38f6462ffd66585c421566e2cc20436d 100644 (file)
@@ -10268,8 +10268,11 @@ cp_parser_elaborated_type_specifier (cp_parser* parser,
   /* Allow attributes on forward declarations of classes.  */
   if (attributes)
     {
-      if (tag_type != enum_type && CLASSTYPE_TEMPLATE_INSTANTIATION (type)
-         && ! processing_explicit_instantiation)
+      if (TREE_CODE (type) == TYPENAME_TYPE)
+       warning (OPT_Wattributes,
+                "attributes ignored on uninstantiated type");
+      else if (tag_type != enum_type && CLASSTYPE_TEMPLATE_INSTANTIATION (type)
+              && ! processing_explicit_instantiation)
        warning (OPT_Wattributes,
                 "attributes ignored on template instantiation");
       else if (is_declaration && cp_parser_declares_only_class_p (parser))
diff --git a/gcc/testsuite/g++.dg/ext/attrib25.C b/gcc/testsuite/g++.dg/ext/attrib25.C
new file mode 100644 (file)
index 0000000..aeffdff
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/28559
+
+template<typename T> struct A
+{
+  struct B;
+};
+
+struct C
+{
+  template<typename T> friend struct __attribute__((packed)) A<T>::B; // { dg-warning "uninstantiated" }
+};