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]

Egcs g++ allows to create object of abstract class ?!


Hello;

Egcs-1.0.2 silently compiles the following code:

$ cat abstract.cc
class A {
public:
  A(int);
  virtual void foo() const = 0;
};

void f(A const& a) 
{
  a.foo();
}

void test() 
{
  // The only way to satisfy this call is to create 
  // temporary object of abstract class A. Compile
  // time error should be generated here, isn't it?
  f(10);
}

$ ~/local/bin/g++ -v -c -Wall abstract.cc
Reading specs from
/home/osv/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.27/specs
gcc version egcs-2.90.27 980315 (egcs-1.0.2 release)
 /home/osv/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.27/cpp
-lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus
-D__GNUC_MINOR__=90 -Di386 -D__ELF__ -Dunix -Dlinux -D__i386__ -D__ELF__
-D__unix__ -D__linux__ -D__i386 -D__unix -D__linux -Asystem(posix)
-D__EXCEPTIONS -Wall -Di386 -Di586 -Asystem(unix) -Acpu(i386)
-Amachine(i386) -D__i386__ -D__i586__ -Asystem(unix) -Acpu(i386)
-Amachine(i386) abstract.cc /tmp/cca16807.ii
GNU CPP version egcs-2.90.27 980315 (egcs-1.0.2 release) (i386
Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /home/osv/local/include/g++
 /usr/local/include
 /home/osv/local/i586-pc-linux-gnulibc1/include
 /home/osv/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.27/include
 /usr/include
End of search list.
 /home/osv/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.27/cc1plus
/tmp/cca16807.ii -quiet -dumpbase abstract.cc -Wall -version -o
/tmp/cca16807.s
GNU C++ version egcs-2.90.27 980315 (egcs-1.0.2 release)
(i586-pc-linux-gnulibc1) compiled by GNU C version egcs-2.90.27 980315
(egcs-1.0.2 release).
 /home/osv/local/i586-pc-linux-gnulibc1/bin/as -V -Qy -o abstract.o
/tmp/cca16807.s
GNU assembler version 971211 (i586-pc-linux-gnulibc1), using BFD version
971211
$

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