re PR c++/29363 (ICE throwing undeclared object)

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
This commit is contained in:
Jason Merrill 2009-11-13 13:46:39 -05:00 committed by Jason Merrill
parent 2b32c27d98
commit 9dd90d8e35
6 changed files with 19 additions and 3 deletions

View 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.

View 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

View 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;

View 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));
}

View 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.

View File

@ -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" }