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

Miles Bader miles at gnu.org
Sun Jun 12 22:17:00 PDT 2011


Cédric Venet <cedric.venet at laposte.net>
writes:
> // this only work on gcc (and most compiler other than clang):
> template<class T> int bar2(T a) { return a+foo2(); }
> int foo2();

This actually _doesn't_ work with any version of g++ I have (4.1 - 4.7):

   t.cc: In function ‘int bar2(T)’:
   t.cc:6:49: error: there are no arguments to ‘foo2’ that depend on a template parameter, so a declaration of ‘foo2’ must be available [-fpermissive]
   t.cc:6:49: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)

-miles

-- 
.Numeric stability is probably not all that important when you're guessing.




More information about the cfe-dev mailing list