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++/18726] New: ICE when calling templated function from templated sister class


Compiler ICE's when calling a template function belonging to a template base 
class using an explicit parameter list. That was a bit obtuse...an example will 
help: 
 
class E inherits from class A<E> and class B<E>. ICE occurs when class B<E> 
downcasts itself to E: 
 
    Derived * e = static_cast<Derived *>(this); 
 
and tries to call a function in A<E> using the syntax: 
 
    e->A<Derived>::template f<int>(); 
 
It compiles fine when the A<Derived>:: scope is not used, and when e is first 
cast to (A<Derived> *). 
 
    e->template f<int>(); 
    static_cast<A<Derived>*>(e)->template f<int>(); 
 
On a related note, neither of these work at all without the "template" keyword, 
but I'm not sure whether that is a bug, or just my ignorance of the standard. 
Contact me if you want me to file a bug on that.

-- 
           Summary: ICE when calling templated function from templated
                    sister class
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rls at tamu dot edu
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i586-mandrake-linux-gnu
  GCC host triplet: i586-mandrake-linux-gnu
GCC target triplet: i586-mandrake-linux-gnu


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


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