https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65845

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |normal

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The expression typeid(Interface()) is the type of a function that returns
Interface, but such a function cannot exist because the type is abstract.

I don't know why typeid(Vector<Interface>) needs to instantiate the default
argument.


The output from trunk is:

t.cc: In function ‘int main()’:
t.cc:20:20: error: ‘type name’ declared as function returning an abstract class
type
   typeid(Interface()).name(); //GCC 4.9.2 and VS2013: doesn't compile
                    ^
t.cc: In instantiation of ‘class Vector<Interface>’:
t.cc:38:1:   required from here
t.cc:11:8: error: cannot allocate an object of abstract type ‘Interface’
   void resize(unsigned n, T val = T()); //C++03 style resize
        ^
t.cc:3:7: note:   because the following virtual functions are pure within
‘Interface’:
 class Interface {
       ^
t.cc:5:15: note:        virtual int Interface::size() const
   virtual int size() const = 0;
               ^

Reply via email to