When I compile this sample (g++ main.cpp -o main)
g++ says that A_val is not defined !
It uses to work with g++ version < 3.4

A.hpp ------------------------

template <typename Var>
class A
{
        public:
                double getA() {return A_val;}
        protected:
                double A_val;
};


B.hpp ---------------------------

#include "A.hpp"

template<typename Var>
class B : public A<Var>
{
        public:
                double getB() {return A_val;}
        protected:
                double B_val;
};

main.cpp ----------------

#include "B.hpp"

int main()
{
        B<int> test;

        test.getA();

        return 0;
}

--------

-- 
           Summary: Problem with template class
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ycollet at freesurf dot fr
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: linux i686 gnu


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

Reply via email to