Instantiation of pure virtual class

Dima Volodin dvv@egcs.dvv.ru
Mon Feb 28 11:03:00 GMT 2000


% cat 00.cc
class C {
public:
        virtual void v () = 0;
};

template <typename C> void f (C);

void g (C& c) {
        f (c);
}
% ./cc1plus -version 00.cc
GNU C++ version 2.96 20000221 (experimental) (i586--solaris2.7) compiled by GNU C version 2.96 20000221 (experimental).
options passed:
options enabled:  -fpeephole -ffunction-cse -fkeep-static-consts
 -fpcc-struct-return -fsched-interblock -fsched-spec -fexceptions
 -fnew-exceptions -fcommon -fgnu-linker -fargument-alias -fident
 -fmath-errno -m80387 -mhard-float -mno-soft-float -mieee-fp
 -mfp-ret-in-387
00.cc: In method `C::C (const C &)':
00.cc:9: Internal compiler error.
00.cc:9: Please submit a full bug report.
00.cc:9: See <URL: http://www.gnu.org/software/gcc/bugs.html > for
00.cc:9: instructions.


With -quiet, it looks better:

% ./cc1plus -version -quiet 00.cc
GNU C++ version 2.96 20000221 (experimental) (i586--solaris2.7) compiled by GNU C version 2.96 20000221 (experimental).
00.cc: In function `void g (C &)':
00.cc:9: cannot allocate an object of type `C'
00.cc:9:   since the following virtual functions are abstract:
00.cc:3:        void C::v ()



On 26 Feb 2000 16:14:31 -0300, you wrote:

>On Feb 25, 2000, Dima Volodin <dvv@dvv.org> wrote:
>
>> A simpler example that demonstrates the problem:
>[snip]
>> With -DTEMPLATE, 2.95.2 compiles it without even a warning.
>
>But the latest snapshot rightfully complains:
>
>/home/lsd/oliva/t.cc: In function `void g (C &)':
>/home/lsd/oliva/t.cc:19: cannot allocate an object of type `C'
>/home/lsd/oliva/t.cc:19:   since the following virtual functions are
>/home/lsd/oliva/t.cc:19: abstract:
>/home/lsd/oliva/t.cc:3:         void C::v ()
>
>It seems that the error message could be improved, so as to point to
>the erroneous function declaration and the template instantiation, but
>it's technically correct.
>
>-- 
>Alexandre Oliva     http://www.ic.unicamp.br/~oliva/     Enjoy Guaraná
>Cygnus Solutions, a Red Hat company        aoliva@{redhat, cygnus}.com
>Free Software Developer and Evangelist    CS PhD student at IC-Unicamp
>oliva@{lsd.ic.unicamp.br, gnu.org}   Write to mailing lists, not to me
>
>



More information about the Gcc-bugs mailing list