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++/51851] New: Overriding a function with a parameter of dependent type fails to override.


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: unassigned@gcc.gnu.org
        ReportedBy: ville.voutilainen@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]


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