Commit c5c39ab3 by Jason Merrill Committed by Jason Merrill

PR c++/42026, DR 239

	PR c++/42026, DR 239
	* parser.c (cp_parser_postfix_expression): A local extern also
	prevents arg-dependent lookup.

From-SVN: r154686
parent 1e1779fe
2009-11-26 Jason Merrill <jason@redhat.com>
PR c++/42026, DR 239
* parser.c (cp_parser_postfix_expression): A local extern also
prevents arg-dependent lookup.
2009-11-26 Gabriel Dos Reis <gdr@cs.tamu.edu>
* decl.c (grokdeclarator): Remove period at end of diagnosic message.
......
......@@ -4844,14 +4844,13 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p,
&& is_overloaded_fn (postfix_expression))
{
tree fn = get_first_fn (postfix_expression);
fn = STRIP_TEMPLATE (fn);
if (TREE_CODE (fn) == TEMPLATE_ID_EXPR)
fn = OVL_CURRENT (TREE_OPERAND (fn, 0));
/* Only do argument dependent lookup if regular
lookup does not find a set of member functions.
[basic.lookup.koenig]/2a */
if (!DECL_FUNCTION_MEMBER_P (fn))
/* Do not do argument dependent lookup if regular
lookup finds a member function or a block-scope
function declaration. [basic.lookup.argdep]/3 */
if (!DECL_FUNCTION_MEMBER_P (fn)
&& !DECL_LOCAL_FUNCTION_P (fn))
{
koenig_p = true;
if (!any_type_dependent_arguments_p (args))
......
2009-11-26 Jason Merrill <jason@redhat.com>
PR c++/42026, DR 239
* g++.dg/lookup/koenig8.C: New.
PR c++/10690
* g++.dg/template/explicit-args2.C: Add typeid cases.
......
// PR c++/42026, DR 239
// The local extern declaration prevents arg-dependent lookup.
// { dg-do link }
namespace NS {
class T { };
void g(T, int);
}
NS::T parm;
void g(NS::T, float) { }
int main() {
extern void g(NS::T, float);
g(parm, 1);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment