re PR c++/54744 (internal compiler error: Segmentation fault, by dependent base, member typedef and ctor-initializer)

PR c++/54744
	* pt.c (resolve_typename_type): Check TYPENAME_IS_RESOLVING_P on scope.

From-SVN: r194269
This commit is contained in:
Jason Merrill 2012-12-06 15:21:44 -05:00 committed by Jason Merrill
parent 4c4b757fcc
commit 877d3792bf
3 changed files with 25 additions and 1 deletions

View File

@ -1,5 +1,8 @@
2012-12-06 Jason Merrill <jason@redhat.com>
PR c++/54744
* pt.c (resolve_typename_type): Check TYPENAME_IS_RESOLVING_P on scope.
PR c++/54947
* parser.c (cp_parser_initializer_list): Don't require an
expression in [] to be constant until we know it's a C99

View File

@ -19806,7 +19806,16 @@ resolve_typename_type (tree type, bool only_current_p)
/* If the SCOPE is itself a TYPENAME_TYPE, then we need to resolve
it first before we can figure out what NAME refers to. */
if (TREE_CODE (scope) == TYPENAME_TYPE)
scope = resolve_typename_type (scope, only_current_p);
{
if (TYPENAME_IS_RESOLVING_P (scope))
/* Given a class template A with a dependent base with nested type C,
typedef typename A::C::C C will land us here, as trying to resolve
the initial A::C leads to the local C typedef, which leads back to
A::C::C. So we break the recursion now. */
return type;
else
scope = resolve_typename_type (scope, only_current_p);
}
/* If we don't know what SCOPE refers to, then we cannot resolve the
TYPENAME_TYPE. */
if (TREE_CODE (scope) == TYPENAME_TYPE)

View File

@ -0,0 +1,12 @@
// PR c++/54744
template <typename T>
struct base {
typedef base base_type;
};
template <typename T>
struct derived : base<T> {
typedef typename derived::base_type::base_type base_type;
derived() : base_type() {}
};