-// To find function pointers in Koenig lookup is ok as long as we only find one.
+// { dg-do assemble }
+// Function pointers are ignored in Koenig lookup. (DR 218)
namespace A{
- void foo(); // ERROR -
+ void foo();
struct X{};
void (*bar)(X*)=0;
}
using A::X;
-void (*foo)(X*)=0; // ERROR -
+void (*foo)(X*)=0;
void g()
{
- foo(new X); // ERROR - both objects and functions found
- bar(new X); // ok
+ foo(new X); // ok -- DR 218 says that we find the global
+ // foo variable first, and therefore do not
+ // perform argument-dependent lookup.
+ bar(new X); // { dg-error "not declared" }
+ // { dg-message "note" "suggested alternative" { target *-*-* } 17 }
}