Commit 3adee96c by Kriang Lerdsuwanakij Committed by Kriang Lerdsuwanakij

re PR c++/5767 (ICE with forwarding template template parameters)

	PR c++/5767
	* parser.c (cp_parser_class_name): Return immediately when scope
	is error_mark_node.

	* g++.dg/parse/crash11.C: New test.

From-SVN: r70226
parent 7d149679
2003-08-07 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/5767
* parser.c (cp_parser_class_name): Return immediately when scope
is error_mark_node.
2003-08-07 Aldy Hernandez <aldyh@redhat.com> 2003-08-07 Aldy Hernandez <aldyh@redhat.com>
* cp/Make-lang.in (cp/call.o): Add dependency for target.h. * cp/Make-lang.in (cp/call.o): Add dependency for target.h.
......
...@@ -10957,6 +10957,9 @@ cp_parser_class_name (cp_parser *parser, ...@@ -10957,6 +10957,9 @@ cp_parser_class_name (cp_parser *parser,
/* PARSER->SCOPE can be cleared when parsing the template-arguments /* PARSER->SCOPE can be cleared when parsing the template-arguments
to a template-id, so we save it here. */ to a template-id, so we save it here. */
scope = parser->scope; scope = parser->scope;
if (scope == error_mark_node)
return error_mark_node;
/* Any name names a type if we're following the `typename' keyword /* Any name names a type if we're following the `typename' keyword
in a qualified name where the enclosing scope is type-dependent. */ in a qualified name where the enclosing scope is type-dependent. */
typename_p = (typename_keyword_p && scope && TYPE_P (scope) typename_p = (typename_keyword_p && scope && TYPE_P (scope)
......
2003-08-07 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/5767
* g++.dg/parse/crash11.C: New test.
2003-08-06 Alexandre Oliva <aoliva@redhat.com> 2003-08-06 Alexandre Oliva <aoliva@redhat.com>
* gcc.dg/cpp/spacing1.c: Update. * gcc.dg/cpp/spacing1.c: Update.
......
// { dg-do compile }
// Origin: priesnit@math.uni-goettingen.de
// PR c++/5767: ICE parsing typename with invalid scope.
template <template <typename> class TP>
struct A
{
template <typename T>
struct Template
{
typedef typename TP<T>::Type Type;
};
};
template <template <typename> class TP>
struct B
{
template <typename T>
struct Template
{
typedef typename A<A<TP>::Template>
::template Template<T>::Type Type; { dg-error "mismatch|class template|unqualified-id" }
};
};
template <typename T>
struct C
{
typedef void Type;
};
int main()
{
typedef B<C>::Template<void>::Type Type; { dg-error "init-declarator|;" }
}
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