OSDN Git Service

PR c++/49921
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 6 Aug 2011 04:34:37 +0000 (04:34 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 6 Aug 2011 04:34:37 +0000 (04:34 +0000)
* semantics.c (finish_decltype_type): Call invalid_nonstatic_memfn_p.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177498 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 964de15..18bf493 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 2f02e69..3d836eb 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 9ce5d9b..cef7f41 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" }