+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.
&& 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))
--- /dev/null
+// 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);
+}