[Bug c++/61987] Name Resolution within a Template
gaoyuanming at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Aug 1 11:27:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61987
--- Comment #7 from Yuanming Gao <gaoyuanming at hotmail dot com> ---
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.
Best regards,
Yuanming
> From: gcc-bugzilla@gcc.gnu.org
> To: gaoyuanming@hotmail.com
> Subject: [Bug c++/61987] Name Resolution within a Template
> Date: Fri, 1 Aug 2014 10:28:36 +0000
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61987
>
> --- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
> G++ and clang++ call f(double) four times, because that is the only function
> visible in the template definition. foo(int) is only visible at the point of
> instantiation, so could only be found by ADL, but int has no associated
> namespaces.
>
> EDG does call foo(int) twice, and fails to compile because the call with
> unsigned long argument could call foo(double) or foo(int) and so is ambiguous.
>
> So either the code never calls foo(int) or the code doesn't compile!
>
> --
> You are receiving this mail because:
> You reported the bug.
More information about the Gcc-bugs
mailing list