https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61987
Daniel Krügler <daniel.kruegler at googlemail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |daniel.kruegler@googlemail. | |com --- Comment #9 from Daniel Krügler <daniel.kruegler at googlemail dot com> --- (In reply to Yuanming Gao from comment #7) > Please read the book: <<Inside the Cpp Object Mode>>. The code comes from > <<7.1 Templates>>. The author thought the function int foo(int) must be > selected. > > Visual C++ can select the int foo(int) correctly. I don't know whether it is > an implementation issue, or it is by design. "Can select" is irrelevant in the context of correctness. As others have already said: The standard requires to consider *only* the overload foo(double), because for fundamental types the associated set of namespaces is empty (see [basic.lookup.argdep] p2 b1). In this case, argument-depending lookup doesn't happen, and only the overloads that can be found lexically before the call location as part of the (reduced) unqualified lookup are considered.