re PR c++/63693 (ICE in resolve_typename_type)
authorPaolo Carlini <paolo.carlini@oracle.com>
Sat, 22 Aug 2015 17:44:46 +0000 (17:44 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sat, 22 Aug 2015 17:44:46 +0000 (17:44 +0000)
/cp
2015-08-22  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/63693
* pt.c (resolve_typename_type): Use CLASSTYPE_PRIMARY_TEMPLATE_TYPE
only on class types.

/testsuite
2015-08-22  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/63693
* g++.dg/cpp0x/decltype63.C: New.

From-SVN: r227098

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/decltype63.C [new file with mode: 0644]

index c2a1206c66d019b008af5dd00961869cc85ec656..b5a3398c8dcf1c0c5e710d69620fa0ab398cce8a 100644 (file)
@@ -1,3 +1,9 @@
+2015-08-22  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/63693
+       * pt.c (resolve_typename_type): Use CLASSTYPE_PRIMARY_TEMPLATE_TYPE
+       only on class types.
+
 2015-08-21  Jason Merrill  <jason@redhat.com>
 
        PR c++/67240
index eaafaeff56915cf845a49518405ea6707b6a366b..fb7b9d21056b3c0212ccb1efef63bc92d7e26774 100644 (file)
@@ -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<T>, so look up the name in the original template.  */
     scope = CLASSTYPE_PRIMARY_TEMPLATE_TYPE (scope);
index da245386899ad451f5ee626afd759b388b8570bc..aad7edceca487a2aaa5614093b143e639d42f96f 100644 (file)
@@ -1,3 +1,8 @@
+2015-08-22  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/63693
+       * g++.dg/cpp0x/decltype63.C: New.
+
 2015-08-22  Nathan Sidwell  <nathan@acm.org>
 
        * 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 (file)
index 0000000..60dfec4
--- /dev/null
@@ -0,0 +1,7 @@
+// PR c++/63693
+// { dg-do compile { target c++11 } }
+
+template<typename T>
+class C{
+ T t;
+ decltype(t)::a::  // { dg-error "expected" }