diff mbox

C++ PATCH for c++/67339 (ICE with alias to PMF)

Message ID 5679C194.8030808@redhat.com
State New
Headers show

Commit Message

Jason Merrill Dec. 22, 2015, 9:33 p.m. UTC
We can't assume that a RECORD_TYPE has TYPE_LANG_SPECIFIC anymore.

Tested x86_64-pc-linux-gnu, applying to trunk and 5.
diff mbox

Patch

commit dafb66bbcf0fd6ef503e3573b2b315230d054c0e
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Dec 21 12:31:22 2015 -0500

    	PR c++/67339
    	* parser.c (cp_parser_elaborated_type_specifier): Use CLASS_TYPE_P
    	rather than check for RECORD_TYPE.

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index c1948c4..262bfb2 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -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
index 0000000..d0ac27d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-pmf1.C
@@ -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;
+}