re PR c++/53721 ([C++11] "this" not allowed in trailing return type)
authorJason Merrill <jason@redhat.com>
Wed, 24 Apr 2013 16:46:53 +0000 (12:46 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 24 Apr 2013 16:46:53 +0000 (12:46 -0400)
PR c++/53721
* parser.c (cp_parser_postfix_dot_deref_expression): Fix thinko.

From-SVN: r198257

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

index 761ca341719d35c31646f9d0542f5a91ebd90de2..770f24ad005a6add39fedca3c10d28c2a518e9d4 100644 (file)
@@ -1,3 +1,8 @@
+2013-04-24  Jason Merrill  <jason@redhat.com>
+
+       PR c++/53721
+       * parser.c (cp_parser_postfix_dot_deref_expression): Fix thinko.
+
 2013-04-24  Paolo Carlini  <paolo.carlini@oracle.com>
 
        * typeck.c (cxx_sizeof_or_alignof_type): Change -Wpointer-arith
index cb2629204049c1310d6bb6bba1744f0b5d6a9e5a..2239a072fe223bccf1767d89eec089ac6e2906c3 100644 (file)
@@ -6155,7 +6155,7 @@ cp_parser_postfix_dot_deref_expression (cp_parser *parser,
       /* Unlike the object expression in other contexts, *this is not
         required to be of complete type for purposes of class member
         access (5.2.5) outside the member function body.  */
-      else if (scope != current_class_ref
+      else if (postfix_expression != current_class_ref
               && !(processing_template_decl && scope == current_class_type))
        scope = complete_type_or_else (scope, NULL_TREE);
       /* Let the name lookup machinery know that we are processing a
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype51.C b/gcc/testsuite/g++.dg/cpp0x/decltype51.C
new file mode 100644 (file)
index 0000000..9ab4146
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/53721
+// { dg-require-effective-target c++11 }
+
+struct A
+{
+  void f() {};
+  auto g() -> decltype(this->f())
+  {
+  }
+};