[LLVMbugs] [Bug 13499] New: override does not work with templated base class

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 31 23:17:01 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13499

             Bug #: 13499
           Summary: override does not work with templated base class
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: mateusz.pusz at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Following code does not work with the latest clang but works fine with gcc:

#include <iostream>

class Base {
public:
  virtual void Run() const = 0;
};

template<class T>
class Derived : public T {
public:
  void Run() const override { std::cout << "Running\n"; }
};

int main(int argc, char** argv)
{
  Derived<Base> obj;
  obj.Run();
}

Following error appears:

error: only virtual member functions can be marked 'override'
  void Run() const override { std::cout << "Running\n"; }
  ^                ~~~~~~~~

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list