http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60775
Bug ID: 60775 Summary: Instantiates unused class template member function and therefor reports error Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gunther.laure at gmail dot com g++ 4.8.2 reports following error when compiling the example code: abstract_class.cpp:11:13: error: cannot allocate an object of abstract type ‘IfSomethingIterator’ Derived operator--(int) ^ abstract_class.cpp:17:7: note: because the following virtual functions are pure within ‘IfSomethingIterator’: class IfSomethingIterator : public iterator_facade<IfSomethingIterator> ^ abstract_class.cpp:24:18: note: virtual void IfSomethingIterator::DoIncrement() virtual void DoIncrement() = 0; The code successfully compiles with: g++4.6.3 g++4.7.3 clang++ 3.3 /// example start template <class Derived> class iterator_facade { public: Derived& operator++() { } Derived operator--(int) { } }; class IfSomethingIterator : public iterator_facade<IfSomethingIterator> { public: virtual ~IfSomethingIterator() {} protected: virtual void DoIncrement() = 0; }; /// example end