[Bug c++/53573] template type dependent name resolution broken

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jun 5 11:54:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53573

--- Comment #16 from Keean Schupke <keean@fry-it.com> 2012-06-05 11:53:32 UTC ---
(In reply to comment #14)

Basic.lookup.argdep is not specific to templates, so why does the dependent
lookup work outside of templates?

int g(int x) {
    return x - 1;
}

double g(double x) {
    return x + 1.0L;
}

main() {
    int x(g(1.0L));
}

why does ADL work here if [basic.lookup.argdep] means what you imply?




> [temp.dep.res] says dependent name resolution considers declarations visible at
> the point of definition, and declarations from associated namespaces from the
> instantiation context and the definition context.
> 
> [basic.lookup.argdep]/2 says "If T is a fundamental type, its associated sets
> of namespaces and classes are both empty."

--- Comment #17 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-06-05 11:53:55 UTC ---
(In reply to comment #13)
> double dd;
> void h()
> {
>     g(2);                   //  will cause one call of  f(char)  followed
>                 //   by two calls of  f(int)
>     g('a');                 //  will cause three calls of  f(char)
> }
> 
> 
> 
> So it was like this in 1998, and it is the same in the latest working draft. 

(Please stop quoting large chunks of copyrighted documents.)

No it isn't the same, the example above was incorrect and different in C++11,
see DR 197: http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#197



More information about the Gcc-bugs mailing list