Commit 9dd90d8e by Jason Merrill Committed by Jason Merrill

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
parent 2b32c27d
2009-11-13 Jason Merrill <jason@redhat.com> 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 PR c++/35075
* pt.c (convert_nontype_argument): Give helpful error about * pt.c (convert_nontype_argument): Give helpful error about
reference variable argument to reference template parameter. reference variable argument to reference template parameter.
......
...@@ -849,6 +849,7 @@ create_implicit_typedef (tree name, tree type) ...@@ -849,6 +849,7 @@ create_implicit_typedef (tree name, tree type)
amongst these. */ amongst these. */
SET_DECL_IMPLICIT_TYPEDEF_P (decl); SET_DECL_IMPLICIT_TYPEDEF_P (decl);
TYPE_NAME (type) = decl; TYPE_NAME (type) = decl;
TYPE_STUB_DECL (type) = decl;
return decl; return decl;
} }
...@@ -3456,7 +3457,6 @@ cxx_init_decl_processing (void) ...@@ -3456,7 +3457,6 @@ cxx_init_decl_processing (void)
bad_alloc_decl bad_alloc_decl
= create_implicit_typedef (bad_alloc_id, bad_alloc_type_node); = create_implicit_typedef (bad_alloc_id, bad_alloc_type_node);
DECL_CONTEXT (bad_alloc_decl) = current_namespace; DECL_CONTEXT (bad_alloc_decl) = current_namespace;
TYPE_STUB_DECL (bad_alloc_type_node) = bad_alloc_decl;
pop_namespace (); pop_namespace ();
ptr_ftype_sizetype ptr_ftype_sizetype
......
...@@ -5288,7 +5288,6 @@ pushtag (tree name, tree type, tag_scope scope) ...@@ -5288,7 +5288,6 @@ pushtag (tree name, tree type, tag_scope scope)
decl = TYPE_NAME (type); decl = TYPE_NAME (type);
gcc_assert (TREE_CODE (decl) == TYPE_DECL); gcc_assert (TREE_CODE (decl) == TYPE_DECL);
TYPE_STUB_DECL (type) = decl;
/* Set type visibility now if this is a forward declaration. */ /* Set type visibility now if this is a forward declaration. */
TREE_PUBLIC (decl) = 1; TREE_PUBLIC (decl) = 1;
......
...@@ -6371,7 +6371,6 @@ lookup_template_class (tree d1, ...@@ -6371,7 +6371,6 @@ lookup_template_class (tree d1,
type_decl = create_implicit_typedef (DECL_NAME (gen_tmpl), t); type_decl = create_implicit_typedef (DECL_NAME (gen_tmpl), t);
DECL_CONTEXT (type_decl) = TYPE_CONTEXT (t); DECL_CONTEXT (type_decl) = TYPE_CONTEXT (t);
TYPE_STUB_DECL (t) = type_decl;
DECL_SOURCE_LOCATION (type_decl) DECL_SOURCE_LOCATION (type_decl)
= DECL_SOURCE_LOCATION (TYPE_STUB_DECL (template_type)); = DECL_SOURCE_LOCATION (TYPE_STUB_DECL (template_type));
} }
......
2009-11-13 Jason Merrill <jason@redhat.com> 2009-11-13 Jason Merrill <jason@redhat.com>
PR c++/29363
* g++.dg/template/error43.C: New.
PR debug/26965 PR debug/26965
* g++.dg/debug/dwarf2/static-data-member2.C: New. * g++.dg/debug/dwarf2/static-data-member2.C: New.
......
// PR c++/29363
template<int> void foo()
{
throw A(); // { dg-message "declar" }
struct A {} a;
}
template void foo<0>(); // { dg-message "instantiated" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment