]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/29363 (ICE throwing undeclared object)
authorJason Merrill <jason@redhat.com>
Fri, 13 Nov 2009 18:46:39 +0000 (13:46 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 13 Nov 2009 18:46:39 +0000 (13:46 -0500)
PR c++/29363
* decl.c (create_implicit_typedef): Set TYPE_STUB_DECL here.
(cxx_init_decl_processing): Not here.
* name-lookup.c (pushtag): Or here.
* pt.c (lookup_template_class): Or here.

From-SVN: r154163

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/name-lookup.c
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/error43.C [new file with mode: 0644]

index d4c44a51dabdf1351a1165ed2fdda06cd28bc78f..722c98342c15929acd161818c0af15ce29eb71f6 100644 (file)
@@ -1,5 +1,11 @@
 2009-11-13  Jason Merrill  <jason@redhat.com>
 
+       PR c++/29363
+       * decl.c (create_implicit_typedef): Set TYPE_STUB_DECL here.
+       (cxx_init_decl_processing): Not here.
+       * name-lookup.c (pushtag): Or here.
+       * pt.c (lookup_template_class): Or here.
+
        PR c++/35075
        * pt.c (convert_nontype_argument): Give helpful error about
        reference variable argument to reference template parameter.
index e23634f3f6ef8237c22e971faa49caabb7861964..0375dd5824ecbcdcb59d9a9a13e49603f65b396b 100644 (file)
@@ -849,6 +849,7 @@ create_implicit_typedef (tree name, tree type)
      amongst these.  */
   SET_DECL_IMPLICIT_TYPEDEF_P (decl);
   TYPE_NAME (type) = decl;
+  TYPE_STUB_DECL (type) = decl;
 
   return decl;
 }
@@ -3456,7 +3457,6 @@ cxx_init_decl_processing (void)
     bad_alloc_decl
       = create_implicit_typedef (bad_alloc_id, bad_alloc_type_node);
     DECL_CONTEXT (bad_alloc_decl) = current_namespace;
-    TYPE_STUB_DECL (bad_alloc_type_node) = bad_alloc_decl;
     pop_namespace ();
 
     ptr_ftype_sizetype
index 14f97873484b6583bdff149a52445a7b732aa321..6b8dcc71877b7f2e720f8d51bb12f94a88347ab0 100644 (file)
@@ -5288,7 +5288,6 @@ pushtag (tree name, tree type, tag_scope scope)
 
   decl = TYPE_NAME (type);
   gcc_assert (TREE_CODE (decl) == TYPE_DECL);
-  TYPE_STUB_DECL (type) = decl;
 
   /* Set type visibility now if this is a forward declaration.  */
   TREE_PUBLIC (decl) = 1;
index c79936838b277fdb8f3d72cc57ef9089e1e210e5..540f5776c25b4b57cdb3cc6cfbc18924efaee819 100644 (file)
@@ -6371,7 +6371,6 @@ lookup_template_class (tree d1,
 
          type_decl = create_implicit_typedef (DECL_NAME (gen_tmpl), t);
          DECL_CONTEXT (type_decl) = TYPE_CONTEXT (t);
-         TYPE_STUB_DECL (t) = type_decl;
          DECL_SOURCE_LOCATION (type_decl)
            = DECL_SOURCE_LOCATION (TYPE_STUB_DECL (template_type));
        }
index c50863f17b0ce8b2dbf822d658efb51cc2dc90e7..91490670e6eabde898e0d603ffd0292dc17e1497 100644 (file)
@@ -1,5 +1,8 @@
 2009-11-13  Jason Merrill  <jason@redhat.com>
 
+       PR c++/29363
+       * g++.dg/template/error43.C: New.
+
        PR debug/26965
        * g++.dg/debug/dwarf2/static-data-member2.C: New.
 
diff --git a/gcc/testsuite/g++.dg/template/error43.C b/gcc/testsuite/g++.dg/template/error43.C
new file mode 100644 (file)
index 0000000..876e018
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/29363
+
+template<int> void foo()
+{
+  throw A();                   // { dg-message "declar" }
+  struct A {} a;
+}
+
+template void foo<0>();                // { dg-message "instantiated" }
This page took 0.120987 seconds and 5 git commands to generate.