[Bug c++/60775] New: Instantiates unused class template member function and therefor reports error

2014-04-07 Thread gunther.laure at gmail dot com
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
   ^
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 iterator_facade
{
public:
Derived& operator++()
{
}
Derived operator--(int)
{
}
};

class IfSomethingIterator : public iterator_facade
{
public:
virtual ~IfSomethingIterator()
{}
protected:
virtual void DoIncrement() = 0;
};
/// example end

[Bug c++/60775] Instantiates unused class template member function and therefor reports error

2014-04-07 Thread gunther.laure at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60775

--- Comment #1 from Gunther Laure  ---
Created attachment 32560
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32560&action=edit
Testcase