Dependent names in template

Mark Mitchell mark@codesourcery.com
Thu Aug 5 23:54:00 GMT 2004


Jonathan Wakely wrote:

>Hi,
>
>I've been testing some template code I've written and have found that
>although it compiles fine with G++ 3.4 it fails with Comeau's online
>compiler. I get an error due to a dependent name not being found during
>the first phase of template lookup. In this case my understanding is that
>the name lookup should have been delayed until the second-phase since it
>is a function call with an argument that is (I believe) a dependent name.
>  
>
Yes.

>I've simplified the code to that below. The lines in question are marked
>ERROR.
>
>The Stream ctor only compiles when std::basic_ios::init() is accessed
>through the "this" pointer. Since buf_ is a dependent name, shouldn't
>init(&buf_) be treated as dependent also?
>  
>
Yes.

>Similarly for the call to sputc(c), int_type is dependent, so aren't c
>and therefore sputc also dependent ?
>  
>
Yes.

>Is G++ wrong here? If so is there a bugzilla report already? (I couldn't
>find one) Is correcting these tiny corner-cases in G++'s now excellent
>parsing on the radar yet?
>  
>
I do not think these are bugs in G++ -- although I've been wrong before.

-- 
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark@codesourcery.com



More information about the Gcc mailing list