Commit eeb23c11 by Mark Mitchell Committed by Mark Mitchell

re PR c++/13314 (ICE when omitting template parameter of a sub-class)

	PR c++/13314
	* emit-rtl.c (set_mem_attributes_minus_bitpos): Robustify.

	PR c++/13314
	* parser.c (cp_parser_class_specifier): Match push_scope/pop_scope
	calls.
	(cp_parser_class_head): Likewise.

	PR c++/13314
	* g++.dg/template/error7.C: New test.

From-SVN: r74359
parent 6a40fb21
2003-12-05 Mark Mitchell <mark@codesourcery.com>
PR c++/13314
* emit-rtl.c (set_mem_attributes_minus_bitpos): Robustify.
2003-12-05 Andrew Pinski <pinskia@physics.uc.edu> 2003-12-05 Andrew Pinski <pinskia@physics.uc.edu>
PR driver/13211 PR driver/13211
......
2003-12-05 Mark Mitchell <mark@codesourcery.com>
PR c++/13314
* parser.c (cp_parser_class_specifier): Match push_scope/pop_scope
calls.
(cp_parser_class_head): Likewise.
2003-12-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> 2003-12-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/13166 PR c++/13166
......
...@@ -11447,6 +11447,8 @@ cp_parser_class_specifier (cp_parser* parser) ...@@ -11447,6 +11447,8 @@ cp_parser_class_specifier (cp_parser* parser)
parser->num_template_parameter_lists = 0; parser->num_template_parameter_lists = 0;
/* Start the class. */ /* Start the class. */
if (nested_name_specifier_p)
push_scope (CP_DECL_CONTEXT (TYPE_MAIN_DECL (type)));
type = begin_class_definition (type); type = begin_class_definition (type);
if (type == error_mark_node) if (type == error_mark_node)
/* If the type is erroneous, skip the entire body of the class. */ /* If the type is erroneous, skip the entire body of the class. */
...@@ -11737,7 +11739,7 @@ cp_parser_class_head (cp_parser* parser, ...@@ -11737,7 +11739,7 @@ cp_parser_class_head (cp_parser* parser,
it is not, try to recover gracefully. */ it is not, try to recover gracefully. */
if (at_namespace_scope_p () if (at_namespace_scope_p ()
&& parser->num_template_parameter_lists == 0 && parser->num_template_parameter_lists == 0
&& num_templates == 1) && template_id_p)
{ {
error ("an explicit specialization must be preceded by 'template <>'"); error ("an explicit specialization must be preceded by 'template <>'");
invalid_explicit_specialization_p = true; invalid_explicit_specialization_p = true;
...@@ -11836,7 +11838,10 @@ cp_parser_class_head (cp_parser* parser, ...@@ -11836,7 +11838,10 @@ cp_parser_class_head (cp_parser* parser,
type = push_template_decl (type); type = push_template_decl (type);
type = TREE_TYPE (type); type = TREE_TYPE (type);
if (nested_name_specifier) if (nested_name_specifier)
*nested_name_specifier_p = true; {
*nested_name_specifier_p = true;
pop_scope (nested_name_specifier);
}
} }
/* Indicate whether this class was declared as a `class' or as a /* Indicate whether this class was declared as a `class' or as a
`struct'. */ `struct'. */
......
...@@ -1826,6 +1826,8 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp, ...@@ -1826,6 +1826,8 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp,
return; return;
type = TYPE_P (t) ? t : TREE_TYPE (t); type = TYPE_P (t) ? t : TREE_TYPE (t);
if (type == error_mark_node)
return;
/* If we have already set DECL_RTL = ref, get_alias_set will get the /* If we have already set DECL_RTL = ref, get_alias_set will get the
wrong answer, as it assumes that DECL_RTL already has the right alias wrong answer, as it assumes that DECL_RTL already has the right alias
......
2003-12-05 Mark Mitchell <mark@codesourcery.com>
PR c++/13314
* g++.dg/template/error7.C: New test.
2003-12-05 Stuart Menefy <stuart.menefy@st.com> 2003-12-05 Stuart Menefy <stuart.menefy@st.com>
J"orn Rennecke <joern.rennecke@superh.com> J"orn Rennecke <joern.rennecke@superh.com>
......
// PR c++/13314
// { dg-options "-O2" }
struct A { template <int> struct B; };
struct A::B {}; // { dg-error "" }
A::B<0> b; // { dg-error "" }
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