Re: g++ and templates

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

 



Hi Mihai,

> Can anyone tell me why the following code won't compile with g++ (4.1.2) ?

Because h was not declared in the scope it is being used in.

Try this:
A<T>::h = t;

Or try this:
this->h = t;

Or try this:
using A<T>::h; // In B, outside of foo.
h = t;

> It is, however, "digested" well by g++ 3.2.2 and g++ 3.3.4

GCC 3.2.x and 3.3.x were not C++ compliant on that issue.

Google for "two phase lookup".

HTH,
--Eljay


[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