finding a function-template

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The example below compiles succesfully with all gcc's pre 3.4, icc, xlC (IBM) but not with gcc-3.4.3. Is gcc-3.4.3 wrong or not? I guess the different behaviour of gcc-3.4.3 is because of the two-phase lookup, although xlC also has two-phase lookup.

This example compiles succesfully with gcc-3.4.3 if the definition of the function 'foo(B)' is moved before the definition of 'bar()'.


#include <iostream>

struct A {} ;
struct B {} ;

template <class T>
void foo(A) { std::cout << "foo(A)" << std::endl ; }

template <class T>
void bar() { foo< T >(B()) ; }

template <class T>
void foo(B) { std::cout << "foo(B)" << std::endl ; }

int main()
{
   bar< int >() ;
   return 0 ;
}


Thanks, toon

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux