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

             Bug #: 51851
           Summary: Overriding a function with a parameter of dependent
                    type fails to override.
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: ville.voutilai...@gmail.com


Test snippet:

template<class T>
struct A
{
       typedef double Point[2];
       virtual double calculate(const Point point) const = 0;
};

template<class T>
struct B : public A<T>
{
       virtual double calculate(const typename A<T>::Point point) const
       {
               return point[0];
       }
};

int main()
{
       B<int> b;
       return 0;
}

gcc says
ville.cpp: In function ‘int main()’:
ville.cpp:19:16: error: cannot declare variable ‘b’ to be of abstract type
‘B<int>’
ville.cpp:9:8: note:   because the following virtual functions are pure within
‘B<int>’:
ville.cpp:5:24: note:     double A<T>::calculate(const double*) const [with T =
int]

Reply via email to