re PR c++/67339 (Segfault when parsing a typename involving a template-alias)
authorJason Merrill <jason@redhat.com>
Tue, 22 Dec 2015 21:46:38 +0000 (16:46 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 22 Dec 2015 21:46:38 +0000 (16:46 -0500)
PR c++/67339
* parser.c (cp_parser_elaborated_type_specifier): Use CLASS_TYPE_P
rather than check for RECORD_TYPE.

From-SVN: r231912

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/g++.dg/cpp0x/alias-decl-pmf1.C [new file with mode: 0644]

index 1d4714ac65b27161daaf936d996dcf5e7a9bef22..dbc7b3e800799b2f8c6ebcb56a5fa03b4620ca83 100644 (file)
@@ -1,3 +1,9 @@
+2015-12-22  Jason Merrill  <jason@redhat.com>
+
+       PR c++/67339
+       * parser.c (cp_parser_elaborated_type_specifier): Use CLASS_TYPE_P
+       rather than check for RECORD_TYPE.
+
 2015-12-22  Patrick Palka  <ppalka@gcc.gnu.org>
 
        * pt.c (make_pack_expansion): Make sure to initialize
index c1948c463ebe1d118fa0f8daa0d796dd9b4a8b6f..262bfb2880571bbd2e5a0536f461993af3b9b356 100644 (file)
@@ -16880,7 +16880,7 @@ cp_parser_elaborated_type_specifier (cp_parser* parser,
     {
       /* Indicate whether this class was declared as a `class' or as a
         `struct'.  */
-      if (TREE_CODE (type) == RECORD_TYPE)
+      if (CLASS_TYPE_P (type))
        CLASSTYPE_DECLARED_CLASS (type) = (tag_type == class_type);
       cp_parser_check_class_key (tag_type, type);
     }
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-pmf1.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-pmf1.C
new file mode 100644 (file)
index 0000000..d0ac27d
--- /dev/null
@@ -0,0 +1,16 @@
+// PR c++/67339
+// { dg-do compile { target c++11 } }
+
+template < typename T>
+struct A
+{
+    void foo();
+    template < typename S, typename W >
+        using N = void (T::*)(S, W) const ;
+};
+
+template < typename T>
+void A<T>::foo()
+{
+    typename A<T>::template N<int, int> fun = &T::out;
+}