aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2012-06-19 21:17:59 -0400
committerJason Merrill <jason@gcc.gnu.org>2012-06-19 21:17:59 -0400
commit420bf978a74296ad1d2b31b9c3dc6551e9e55653 (patch)
tree025de89d58452f15290e0fc94b9f74213296d815 /gcc
parent8930883ee93cb4701259e8738f51530d609812f7 (diff)
downloadgcc-420bf978a74296ad1d2b31b9c3dc6551e9e55653.zip
gcc-420bf978a74296ad1d2b31b9c3dc6551e9e55653.tar.gz
gcc-420bf978a74296ad1d2b31b9c3dc6551e9e55653.tar.bz2
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: r188807
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/name-lookup.c5
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/decltype37.C14
4 files changed, 30 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b450775..562f945 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2012-06-14 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.
+
2012-06-18 Lawrence Crowl <crowl@google.com>
* decl2.c (cp_write_global_declarations): Rename use of TV_PHASE_CGRAPH
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 0f28820..cc8439c 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -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;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 86d6ab1..07071a9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-14 Jason Merrill <jason@redhat.com>
+
+ PR c++/53651
+ * g++.dg/cpp0x/decltype37.C: New.
+
2012-06-19 Kaz Kojima <kkojima@gcc.gnu.org>
* gcc.dg/stack-usage-1.c: Use sh*-*-* instead of sh-*-*.
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype37.C b/gcc/testsuite/g++.dg/cpp0x/decltype37.C
new file mode 100644
index 0000000..c885e9a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype37.C
@@ -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;