From: Jason Merrill Date: Thu, 15 Sep 2011 14:33:37 +0000 (-0400) Subject: re PR c++/50365 (non-static data member error on valid code) X-Git-Tag: releases/gcc-4.7.0~3751 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5a8c97d80213bed41128b450c3bb174c905459e3;p=thirdparty%2Fgcc.git re PR c++/50365 (non-static data member error on valid code) PR c++/50365 * parser.c (cp_parser_late_return_type_opt): Check quals parameter for clearing current_class_ptr, too. From-SVN: r178883 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index be4f63b8398f..c52dcd76e18e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-09-15 Jason Merrill + + 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 * name-lookup.c (lookup_arg_dependent): Use conditional diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 03f75fc3edff..228331243303 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/ChangeLog b/gcc/testsuite/ChangeLog index 0bf61702db06..86cdde08bac9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2011-09-15 Jason Merrill + 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 index 000000000000..c4db10ec80d7 --- /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); +}