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]

Strange error message about a template class not being a class


Bug report:

Compiler: g++ version 2.95.2 19991024 (release)
System:   redhat Linux 6.1 on a Pentium III
Compiler call and messages:

++ design2.C
design2.C:17: `p_HDS<p_Items>' is not a class, struct, or union type
design2.C:17: syntax error before `{'

The program:
// design.2
// ------------------------------------------

template <class T>
struct HalfedgeDS {
    typedef T* Handle;
};

template < class p_Items, template < class I> class p_HDS>
struct Polyhedron_3 {
    typedef p_HDS< p_Items>       HDS;
    typedef typename HDS::Handle  Handle;
    void foo( Handle v );
};

template < class p_Items, template < class I> class p_HDS >
void  Polyhedron_3<p_Items,p_HDS>::foo( Handle v) {}


int main() {
    Polyhedron_3< int, HalfedgeDS> P;
    int* v = 0;
    P.foo( v);
    return 0;
}
// EOF //

I have no workaround for this. Note, the Handle parameter and the
external definition are necessary to create that error message.

Best regards,

Lutz Kettner 

----------------------------------------------------------------------
UNC Computer Science                       email: kettner@cs.unc.edu
CB 3175, Sitterson Hall                    phone: (919) 962-1846
Chapel Hill, NC 27599-3175, USA            fax:   (919) 962-1799
----------------------------------------------------------------------


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