re PR c++/53651 ([C++11] seg fault when specifying using decltype(...)::method)

PR c++/53651
	* name-lookup.c (constructor_name_p): Don't try to look at the
	name of a DECLTYPE_TYPE.

From-SVN: r188813
This commit is contained in:
Jason Merrill 2012-06-20 03:22:34 -04:00 committed by Jason Merrill
parent 912bc3ba41
commit 70395d98a1
4 changed files with 26 additions and 0 deletions

View File

@ -1,5 +1,9 @@
2012-06-19 Jason Merrill <jason@redhat.com>
PR c++/53651
* name-lookup.c (constructor_name_p): Don't try to look at the
name of a DECLTYPE_TYPE.
Reapply:
PR c++/53137
* pt.c (instantiate_class_template_1): Set LAMBDA_EXPR_THIS_CAPTURE.

View File

@ -1966,6 +1966,11 @@ constructor_name_p (tree name, tree type)
if (TREE_CODE (name) != IDENTIFIER_NODE)
return false;
/* These don't have names. */
if (TREE_CODE (type) == DECLTYPE_TYPE
|| TREE_CODE (type) == TYPEOF_TYPE)
return false;
ctor_name = constructor_name_full (type);
if (name == ctor_name)
return true;

View File

@ -1,5 +1,8 @@
2012-06-19 Jason Merrill <jason@redhat.com>
PR c++/53651
* g++.dg/cpp0x/decltype37.C: New.
PR c++/52637
* g++.dg/debug/localclass1.C: New.

View File

@ -0,0 +1,14 @@
// PR c++/53651
// { dg-do compile { target c++11 } }
template<typename> struct wrap { void bar(); };
template<typename T> auto foo(T* t) -> wrap<T>* { return 0; }
template<typename T>
struct holder : decltype(*foo((T*)0)) // { dg-error "class type" }
{
using decltype(*foo((T*)0))::bar; // { dg-error "is not a base" }
};
holder<int> h;