Comments
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.
@@ -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;
new file mode 100644
@@ -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);
+}