A point from the ISO C++ draft (n3290):
3.4.2/3 Argument Dependant Name Lookup:
Let
Xbe the lookup set produced by unqualified lookup (3.4.1) and
letYbe the lookup set produced by argument dependent lookup
(defined as follows). IfXcontains
- a declaration of a class member (#1) or
- a block-scope function
declaration that is not a using-declaration (#2) or- a declaration
that is neither a function or a function template (#3)then
Yis empty. OtherwiseYis the set of declarations found in
the namespaces associated with the argument types as described below.
The set of declarations found by the lookup of the name is the union
ofXandY.
Is there an example code snippet that demonstrates ADL involving #1, #2 and #3?
I think this code covers all the cases (also available at http://ideone.com/CbyJv). If you don’t select C++0x in ideone, then case #2 is allowed (but gcc 4.5.2 catches it).