This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
pure virtual method called
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: pure virtual method called
- From: Yotam Medini <yotam at tharas dot com>
- Date: Thu, 1 Jul 1999 16:42:56 -0700
- Reply-to: yotam at tharas dot com
Yet another simple example.
This should have been a _compile_ time error, not run time.
################################################################
emu:195> g++ -v
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
emu:196> cat virtcalled.cc
class ABS
{
public:
virtual void vf() const = 0;
}; // ABS
void dum(const ABS& a) {
a.vf();
}
int main(int, char**) {
# if defined(GoodCheck)
ABS abs;
# endif
dum(ABS());
return 0;
}
emu:197> g++ -o /tmp/vc -Wall virtcalled.cc
emu:198> /tmp/vc
pure virtual method called
emu:199>
##############################################################
-- yotam