[Bug c++/17772] New: Derivating a templated class, the members of the base class are unknown

Serge dot Iovleff at univ-lille1 dot fr gcc-bugzilla@gcc.gnu.org
Fri Oct 1 10:50:00 GMT 2004


Here is an exemple

template<class TYPE> class A
{ public:
    TYPE q;
    A() { q =0;}
    ~A() { ;}
};

template<class TYPE> class B : public A<TYPE>
{ public:
     B(TYPE n) : A<TYPE>() { q =n;}
    ~B() { ;}
};

int main(int argc, char *argv[])
{
  B<int> b(3);
}

$ g++-3.4 test.cpp -g -O2 -o test
essai.cpp: In constructor `B<TYPE>::B(TYPE)':
essai.cpp:14: erreur: « q » non déclaré (première utilisation dans cette fonction)
essai.cpp:14: erreur: (Chaque identificateur non déclaré est rapporté seulement
une seule fois pour la fonction dans laquelle il apparaît.)

My locale is in french, the compilator say that q is unknown.

$g++-3.3 test.cpp -g -O2 -o test
work fine.

Serge

-- 
           Summary: Derivating a templated class, the members of the base
                    class are unknown
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Serge dot Iovleff at univ-lille1 dot fr
                CC: gcc-bugs at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list