From: Jason Merrill Date: Wed, 27 Apr 2011 05:20:33 +0000 (-0400) Subject: re PR c++/42687 (The prevention of ADL with the help of parentheses doesn't work) X-Git-Tag: releases/gcc-4.4.7~430 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4febc53fbfbefa9f0c689cfc6b6d4cd2d1e7b7eb;p=thirdparty%2Fgcc.git re PR c++/42687 (The prevention of ADL with the help of parentheses doesn't work) PR c++/42687 * parser.c (cp_parser_primary_expression): Set *idk to CP_ID_KIND_NONE for a parenthesized identifier. From-SVN: r173009 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0ae5b3ca2c5f..ffc7e8c4c33c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-04-26 Jason Merrill + + PR c++/42687 + * parser.c (cp_parser_primary_expression): Set *idk to + CP_ID_KIND_NONE for a parenthesized identifier. + 2011-04-20 Jason Merrill PR c++/48594 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 64e7329641a2..f219b1b5926c 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -3274,6 +3274,12 @@ cp_parser_primary_expression (cp_parser *parser, `&A::B' might be a pointer-to-member, but `&(A::B)' is not. */ finish_parenthesized_expr (expr); + /* DR 705: Wrapping an unqualified name in parentheses + suppresses arg-dependent lookup. We want to pass back + CP_ID_KIND_QUALIFIED for suppressing vtable lookup + (c++/37862), but none of the others. */ + if (*idk != CP_ID_KIND_QUALIFIED) + *idk = CP_ID_KIND_NONE; } /* The `>' token might be the end of a template-id or template-parameter-list now. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 223467dd44ba..e4be02824272 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-04-26 Jason Merrill + + * g++.dg/lookup/koenig13.C: New. + 2011-04-20 Jason Merrill * g++.dg/template/operator11.C: New. diff --git a/gcc/testsuite/g++.dg/lookup/koenig13.C b/gcc/testsuite/g++.dg/lookup/koenig13.C new file mode 100644 index 000000000000..625a181f6214 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/koenig13.C @@ -0,0 +1,16 @@ +// PR c++/42687 +// DR 705 + +namespace N +{ + struct S { }; + void f(const S &) { } +} + +void f(const N::S &) { } + +int main() +{ + N::S v; + (f)(v); // no ambiguity: ADL is prevented with (), only ::f is considered +}