re PR c++/49921 ([C++0x] Segfault during compilation, decltype and operator->*)
authorJason Merrill <jason@redhat.com>
Sat, 6 Aug 2011 04:34:37 +0000 (00:34 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Sat, 6 Aug 2011 04:34:37 +0000 (00:34 -0400)
PR c++/49921
* semantics.c (finish_decltype_type): Call invalid_nonstatic_memfn_p.

From-SVN: r177498

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

index 964de150272d4c6aa4fa151aea30f622aa4d6e61..18bf49385ed987bb4dd61ce6cba0de777be32639 100644 (file)
@@ -1,5 +1,8 @@
 2011-08-05  Jason Merrill  <jason@redhat.com>
 
+       PR c++/49921
+       * semantics.c (finish_decltype_type): Call invalid_nonstatic_memfn_p.
+
        PR c++/49669
        * init.c (perform_member_init): Handle invalid array initializer.
 
index 2f02e696dbad7b03ef1f5a6308094dab56d8dd6d..3d836eb56c79564887eae51ec2ba377d66e9b4ca 100644 (file)
@@ -4948,6 +4948,9 @@ finish_decltype_type (tree expr, bool id_expression_or_member_access_p,
       return error_mark_node;
     }
 
+  if (invalid_nonstatic_memfn_p (expr, complain))
+    return error_mark_node;
+
   /* To get the size of a static data member declared as an array of
      unknown bound, we need to instantiate it.  */
   if (TREE_CODE (expr) == VAR_DECL
index 9ce5d9b75f81e53506b29cdb1d144c43e1fe0c2a..cef7f415a193ba2bd71ffdf282a305b5f745eaf5 100644 (file)
@@ -1,5 +1,8 @@
 2011-08-05  Jason Merrill  <jason@redhat.com>
 
+       PR c++/49921
+       * g++.dg/cpp0x/decltype31.C: New.
+
        PR c++/49669
        * g++.dg/init/array28.C: New.
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype31.C b/gcc/testsuite/g++.dg/cpp0x/decltype31.C
new file mode 100644 (file)
index 0000000..b9817eb
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/49921
+// { dg-options -std=c++0x }
+
+struct Local
+{
+  void f();
+};
+
+Local *l;
+void (Local::*ptr)();
+decltype((l->*ptr)) i;        // { dg-error "member function" }
+
+// { dg-prune-output "invalid type in declaration" }