This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/61987] Name Resolution within a Template
- From: "daniel.kruegler at googlemail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 01 Aug 2014 18:39:32 +0000
- Subject: [Bug c++/61987] Name Resolution within a Template
- Auto-submitted: auto-generated
- References: <bug-61987-4 at http dot gcc dot gnu dot org/bugzilla/>
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.