re PR c++/55670 ([C++11] This isn't a pure virtual method.)
authorJason Merrill <jason@redhat.com>
Thu, 14 Feb 2013 04:31:03 +0000 (23:31 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 14 Feb 2013 04:31:03 +0000 (23:31 -0500)
PR c++/55670
* parser.c (cp_parser_member_declaration): Check the declarator
form when detecting a function declaration via typedef.

From-SVN: r196043

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

index d28a6049a81db12e7919c4f124180a8180f23983..033aa1ec066a25294a42dc60150c689a20e7812c 100644 (file)
@@ -1,5 +1,9 @@
 2013-02-13  Jason Merrill  <jason@redhat.com>
 
+       PR c++/55670
+       * parser.c (cp_parser_member_declaration): Check the declarator
+       form when detecting a function declaration via typedef.
+
        PR c++/55680
        * pt.c (maybe_process_partial_specialization): A lambda
        isn't what's being specialized.
index 402f384102beb6c9b8f25d68df5da3689219f620..d18e0278cdeb1965d36af7dd8bb3e93335ecc68b 100644 (file)
@@ -19366,6 +19366,7 @@ cp_parser_member_declaration (cp_parser* parser)
                  if (function_declarator_p (declarator)
                      || (decl_specifiers.type
                          && TREE_CODE (decl_specifiers.type) == TYPE_DECL
+                         && declarator->kind == cdk_id
                          && (TREE_CODE (TREE_TYPE (decl_specifiers.type))
                              == FUNCTION_TYPE)))
                    initializer = cp_parser_pure_specifier (parser);
diff --git a/gcc/testsuite/g++.dg/cpp0x/nsdmi8.C b/gcc/testsuite/g++.dg/cpp0x/nsdmi8.C
new file mode 100644 (file)
index 0000000..f89bec6
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/55670
+// { dg-do compile { target c++11 } }
+
+template <class T> using F = T;
+struct X {
+    F<void ()>* fp = nullptr;
+};
+int main () { return 0; }