This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/61987] Name Resolution within a Template


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]