From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cristi Vlasceanu To: wdjbugs@hightechinfo.com, bug-gcc@gnu.org Subject: bug report Date: Fri, 31 Dec 1999 20:54:00 -0000 Message-id: <714D93E3EBA0D311A30100805FAF80850BC9EE@exchange> X-SW-Source: 1999-12n/msg00676.html List-Id: // This code demonstrates a bug in the following compilers: // // MSVC++ 6.0 (sp3) // Code Warrior 5.0 // egcs 2.91.60 (system: Caldera Open Linux 2.1, command line: g++ main.cpp) // Comeau 4.2.42 (online test drive) #include using namespace std; class A { public: A() {} /* explicit */ A(int) {} virtual void Func() const = 0; }; void Fubar(const A& a) { a.Func(); } int main() { // error: cannot instantiate abstract class // A a; // error: cannot instantiate abstract class // A a(42); try { // ***************************************** // implicit conversion to abstract class A, // should not compile but it does, when using: // MSVC++ 6.0 (sp3) // Code Warrior 5.0 // egcs 2.91.60 // Comeau 4.2.42 // The error is promptly detected by Borland // C++ Builder 4.0 Fubar(42); // error: cannot instantiate abstract class // throw A(); // compiles fine under MSVC 6.0 SP3, but // shouldn't // throw A(0); } catch (A& a) { a.Func(); } return 0; } Cristian Vlasceanu, Software Engineer, Netzip Inc.