[PATCH] c++: Function found via ADL when it should not [PR95074]

Nathan Sidwell nathan@acm.org
Tue May 12 20:21:57 GMT 2020


On 5/12/20 4:18 PM, Marek Polacek wrote:
> I noticed that we don't implement [basic.lookup.argdep]/3: quite correctly;
> it says "If X (the lookup set produced by unqualified lookup) contains
> -- a block-scope function declaration that is not a using-declaration
> [...]
> then Y (the lookup set produced by ADL) is empty."
> but we were still performing ADL in fn1 in the attached test.  The
> problem was that we were only looking at the first function in the
> overload set which in this case happened to be a using-declaration, and
> those don't suppress ADL.  We have to look through the whole set to find
> out if unqualified lookup found a block-scope function declaration, or
> a member function declaration.
> 
> Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?
> 
> 	PR c++/95074
> 	* parser.c (cp_parser_postfix_expression) <case CPP_OPEN_PAREN>: When
> 	looking for a block-scope function declaration, look through the whole
> 	set, not just the first function in the overload set.
> 

ok, thanks!


-- 
Nathan Sidwell


More information about the Gcc-patches mailing list