This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


I forgot to fix the other test in my patch for 49691. Oops.

Tested x86_64-pc-linux-gnu, applying to trunk.
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);
+}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]