Patchwork C++ PATCH for c++/50365 (regression with -> decl/expr ambiguity)

login
register
mail settings
Submitter Jason Merrill
Date Sept. 15, 2011, 2:27 p.m.
Message ID <4E720B4F.4040608@redhat.com>
Download mbox | patch
Permalink /patch/114794/
State New
Headers show

Comments

Jason Merrill - Sept. 15, 2011, 2:27 p.m.
I forgot to fix the other test in my patch for 49691.  Oops.

Tested x86_64-pc-linux-gnu, applying to trunk.

Patch

commit 5e0bb3e7f8287cd88f09b8f10c126e5b5f0711b2
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Sep 15 10:06:19 2011 -0400

    	PR c++/50365
    	* parser.c (cp_parser_late_return_type_opt): Check quals parameter
    	for clearing current_class_ptr, too.

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 03f75fc..2283312 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -15721,7 +15721,7 @@  cp_parser_late_return_type_opt (cp_parser* parser, cp_cv_quals quals)
 
   type = cp_parser_trailing_type_id (parser);
 
-  if (current_class_type)
+  if (quals >= 0)
     current_class_ptr = current_class_ref = NULL_TREE;
 
   return type;
diff --git a/gcc/testsuite/g++.dg/cpp0x/trailing7.C b/gcc/testsuite/g++.dg/cpp0x/trailing7.C
new file mode 100644
index 0000000..c4db10e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/trailing7.C
@@ -0,0 +1,14 @@ 
+// PR c++/50365
+// { dg-options -std=c++0x }
+
+struct A { int i; };
+
+struct B {
+  B();
+  A* f();
+};
+
+B::B()
+{
+  int(f()->i);
+}