]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/50365 (non-static data member error on valid code)
authorJason Merrill <jason@redhat.com>
Thu, 15 Sep 2011 14:33:37 +0000 (10:33 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 15 Sep 2011 14:33:37 +0000 (10:33 -0400)
PR c++/50365
* parser.c (cp_parser_late_return_type_opt): Check quals parameter
for clearing current_class_ptr, too.

From-SVN: r178883

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

index be4f63b8398f62766f319667adf96d02aff78d59..c52dcd76e18e812c8a979ae8b2223e16c3e1ec67 100644 (file)
@@ -1,3 +1,9 @@
+2011-09-15  Jason Merrill  <jason@redhat.com>
+
+       PR c++/50365
+       * parser.c (cp_parser_late_return_type_opt): Check quals parameter
+       for clearing current_class_ptr, too.
+
 2011-09-14   Diego Novillo  <dnovillo@google.com>
 
        * name-lookup.c (lookup_arg_dependent): Use conditional
index 03f75fc3edff4a6a58e4a022250a531de8200c95..228331243303af6ec0b9b34079f3c7d3ec4f7194 100644 (file)
@@ -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;
index 0bf61702db06d2dca493f7d2eccf909f77bac5f0..86cdde08bac9a1e260aa4ba83ad66196e86f95db 100644 (file)
@@ -1,5 +1,8 @@
 2011-09-15  Jason Merrill  <jason@redhat.com>
 
+       PR c++/50365
+       * g++.dg/cpp0x/trailing7.C: New.
+
        PR c++/50361
        * g++.dg/cpp0x/nullptr23.C: New.
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/trailing7.C b/gcc/testsuite/g++.dg/cpp0x/trailing7.C
new file mode 100644 (file)
index 0000000..c4db10e
--- /dev/null
@@ -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);
+}