g++ and templates

Mihai Donțu mihai.dontu@gmail.com
Thu Feb 21 14:56:00 GMT 2008


On Thursday 21 February 2008, Eljay Love-Jensen wrote:
> 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".

Thank you for your quick reply. :)

-- 
Mihai Donțu



More information about the Gcc-help mailing list