This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/12046] parse error in template function


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12046


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-08-24 17:54 -------
The code is invalid as the template C<Traits<T>::b>::f in any_f is depend on the template 
argument T so you need to  help the compiler to know that it is a template.
Here is the correct fix:
template<class T> T any_f(T x)
{
    return C<Traits<T>::b>::template f<T>(x);
}

Also note you specifications of Traits are wrong, they should have template<> infront of the 
structs, also the specifications of C is the same way.
Once these are fixed you can compile your code on the mainline of GCC.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]