Commit 905319d9 by Paolo Carlini Committed by Paolo Carlini

re PR c++/37087 (Segfault on compiling template defined in wrong namespace.)

/cp
2008-08-12  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/37087
	* parser.c (cp_parser_class_head): Early return error_mark_node in
	case of global qualification of class name or qualified name that
	does not name a class.

/testsuite
2008-08-12  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/37087
	* g++.dg/template/crash80.C: New.
	* g++.old-deja/g++.other/decl5.C: Adjust.

From-SVN: r139034
parent 4d2b059d
2008-08-12 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/37087
* parser.c (cp_parser_class_head): Early return error_mark_node in
case of global qualification of class name or qualified name that
does not name a class.
2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c++/12242
......
......@@ -14981,11 +14981,17 @@ cp_parser_class_head (cp_parser* parser,
cp_parser_commit_to_tentative_parse (parser);
/* Issue the error about the overly-qualified name now. */
if (qualified_p)
cp_parser_error (parser,
"global qualification of class name is invalid");
{
cp_parser_error (parser,
"global qualification of class name is invalid");
return error_mark_node;
}
else if (invalid_nested_name_p)
cp_parser_error (parser,
"qualified name does not name a class");
{
cp_parser_error (parser,
"qualified name does not name a class");
return error_mark_node;
}
else if (nested_name_specifier)
{
tree scope;
......
2008-08-12 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/37087
* g++.dg/template/crash80.C: New.
* g++.old-deja/g++.other/decl5.C: Adjust.
2008-08-12 Jakub Jelinek <jakub@redhat.com>
PR middle-end/37014
......
// PR c++/37087
namespace a {
template <typename T> class Foo;
}
namespace b {
template <> class ::a::Foo<double> {}; // { dg-error "error: global qualification of class name is invalid" }
}
......@@ -16,7 +16,7 @@ struct A {
int m;
};
struct Z;
expand me;
expand me; // { dg-error "" } not name a type
void foo(struct A::e);
void foo(struct A::z); // { dg-warning "" } extra qualification
};
......@@ -71,7 +71,7 @@ namespace NMS
};
}
NMS::D thing;
NMS::D thing; // { dg-error "" } not name a type
void NMS::fn()
{
i = 3;
......
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