re PR c++/49823 ([C++0x] ICE on decltype(expr)::type with template)

PR c++/49823
	* parser.c (cp_parser_qualifying_entity): Handle templates.

From-SVN: r176732
This commit is contained in:
Jason Merrill 2011-07-25 01:03:50 -04:00 committed by Jason Merrill
parent 149e741d2c
commit 3bb4eb1cb3
4 changed files with 28 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2011-07-23 Jason Merrill <jason@redhat.com>
PR c++/49823
* parser.c (cp_parser_qualifying_entity): Handle templates.
2011-07-22 Jason Merrill <jason@redhat.com>
PR c++/49793

View File

@ -4638,7 +4638,9 @@ cp_parser_qualifying_entity (cp_parser *parser,
cp_parser_simulate_error (parser);
return error_mark_node;
}
return TYPE_NAME (scope);
if (TYPE_NAME (scope))
scope = TYPE_NAME (scope);
return scope;
}
/* Before we try to parse the class-name, we must save away the

View File

@ -1,3 +1,7 @@
2011-07-23 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/decltype21.C: Add 49823 examples.
2011-07-22 Jason Merrill <jason@redhat.com>
PR c++/49793

View File

@ -10,6 +10,22 @@ struct c : decltype(make<p>()) {};
decltype(make<p>())::t t;
// PR c++/49823
template < typename T >
auto f( const T &x )
-> typename decltype( x )::type; // ICE on here
template < typename T >
typename decltype( T{} )::type // ICE on here
f( T );
template < typename T >
void f( T x )
{ typename decltype( x )::type t; } // ICE on here
// Negative tests
int f();
decltype(f())::t t2; // { dg-error "not a class" }