From c6d30d029817dba03e13b8f5cf0936494b5adaaa Mon Sep 17 00:00:00 2001 From: paolo Date: Sat, 22 Aug 2015 17:44:46 +0000 Subject: [PATCH] /cp 2015-08-22 Paolo Carlini PR c++/63693 * pt.c (resolve_typename_type): Use CLASSTYPE_PRIMARY_TEMPLATE_TYPE only on class types. /testsuite 2015-08-22 Paolo Carlini PR c++/63693 * g++.dg/cpp0x/decltype63.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@227098 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/pt.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp0x/decltype63.C | 7 +++++++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype63.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c2a1206c66d..b5a3398c8dc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2015-08-22 Paolo Carlini + + PR c++/63693 + * pt.c (resolve_typename_type): Use CLASSTYPE_PRIMARY_TEMPLATE_TYPE + only on class types. + 2015-08-21 Jason Merrill PR c++/67240 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index eaafaeff569..fb7b9d21056 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -22673,7 +22673,8 @@ resolve_typename_type (tree type, bool only_current_p) return type; /* If SCOPE isn't the template itself, it will not have a valid TYPE_FIELDS list. */ - if (same_type_p (scope, CLASSTYPE_PRIMARY_TEMPLATE_TYPE (scope))) + if (CLASS_TYPE_P (scope) + && same_type_p (scope, CLASSTYPE_PRIMARY_TEMPLATE_TYPE (scope))) /* scope is either the template itself or a compatible instantiation like X, so look up the name in the original template. */ scope = CLASSTYPE_PRIMARY_TEMPLATE_TYPE (scope); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index da245386899..aad7edceca4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-08-22 Paolo Carlini + + PR c++/63693 + * g++.dg/cpp0x/decltype63.C: New. + 2015-08-22 Nathan Sidwell * c-c++-common/Wsizeof-pointer-memaccess1.c: Require alloca. diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype63.C b/gcc/testsuite/g++.dg/cpp0x/decltype63.C new file mode 100644 index 00000000000..60dfec47a41 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype63.C @@ -0,0 +1,7 @@ +// PR c++/63693 +// { dg-do compile { target c++11 } } + +template +class C{ + T t; + decltype(t)::a:: // { dg-error "expected" } -- 2.11.4.GIT