This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

pure virtual method called



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]