[Bug c++/10437] "using namespace" at global scope creates incorrect code
nathan at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Mon Dec 22 16:51:00 GMT 2003
------- Additional Comments From nathan at gcc dot gnu dot org 2003-12-22 16:36 -------
Ok, First point1. Do using declarations work retroactively in this regard.
For a dependent name, the answer is yes, sort of. [14.6.4] lists the places you
look to resolve a dependent name, and they are
1) declarations that are visible at the point of definition of the template
2) declarations from namespaces associated with the type of the function arguments
both from the instantiation context and from the definition context.
That 2nd part is an amalgamated koenig lookup. In this case the type is int, so
has no associated namespaces, and hence adds nothing to the overload set.
Thus, I believe instantiation of bar will give an unresolved call for foo.
Now the second point. This a case of SFINAE failure, no diagnostic should
be issued. The call of foo in bar must resolve to ::foo(int), as the other
posibility ::foo<int>(const int &) gives a substitution failure.
The EDG compiler accepts this code.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|nathan at gcc dot gnu dot |unassigned at gcc dot gnu
|org |dot org
Status|ASSIGNED |NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10437
More information about the Gcc-bugs
mailing list