[cfe-dev] clang ignoring global function declaration depending on include/declaration order

Cédric Venet cedric.venet at laposte.net
Sat Jun 11 08:03:33 PDT 2011


> clang++ ignores a global function declaration.
> Whether the issue occurs is depending on the order of include files.

what do you mean ignore?
if the problem is due to template definition using a non dependent 
function before declaring it, then this is not a bug but better respect 
of the standard.
exemple:

// this work on gcc and clang
int foo();
template<class T> int bar(T a) { return a+foo(); }

// this only work on gcc (and most compiler other than clang):
template<class T> int bar2(T a) { return a+foo2(); }
int foo2();

int main() {
     return bar(5.)+bar2(5.);
}

notice that this is not true for dependent name lookup.

regards,
Cédric



More information about the cfe-dev mailing list