The compiler thinks we're allocating the actual abstract objects instead of an array of pointers and reports the following error: "cannot allocate an object of abstract type '...'". Since we're actual allocating an array of pointers, this should not be an error.
The following code (reproduce.cpp) demonstrates the problem: class pure { public: pure() {} virtual bool isPure () = 0; }; class notPure : public pure { public: notPure() {} virtual bool isPure () { return false; }; }; int main () { pure ** list; list = new (pure (*[3])); for (int i = 0; i < 3; i ++) { list [i] = new notPure(); } } The error is reported on line 18 "list = new (pure (*[3]));". gcc -v results in: Using built-in specs. Target: i686-linux Configured with: ../gcc-4.1.1/configure --prefix=/p/TargetPlatforms/x86-Linux-cdk/cross-gcc/build/tools --target=i686-linux --build=i686-pc-mingw32 --host=i686-pc-mingw32 --disable-multilib --with-local-prefix=/p/TargetPlatforms/x86-Linux-cdk/cross-gcc/build/tools --with-system-zlib --disable-libunwind-exceptions --disable-nls --enable-shared --enable-languages=c,c++ --enable-__cxa_atexit --enable-c99 --enable-long-long --enable-threads=posix --enable-win32-registry=oce-gcc4.1.1-glibc2.5 Thread model: posix gcc version 4.1.1 We're cross compiling from Windows to Linux. The command line is very basic: "gcc reproduce.cpp" This results in the following compiler output: reproduce.cpp: In function 'int main()': reproduce.cpp:18: error: cannot allocate an object of abstract type 'pure' reproduce.cpp:2: note: because the following virtual functions are pure within 'pure': reproduce.cpp:5: note: virtual bool pure::isPure() The preprocessed file looks as follows: # 1 "reproduce.cpp" # 1 "<built-in>" # 1 "<command line>" # 1 "reproduce.cpp" class pure { public: pure() {} virtual bool isPure () = 0; }; class notPure : public pure { public: notPure() {} virtual bool isPure () { return false; }; }; int main () { pure ** list; list = new (pure (*[3])); for (int i = 0; i < 3; i ++) { list [i] = new notPure(); } } -- Summary: Error while allocating array of pointers to objects of a pure virtual class Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: p dot vestjens at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32402