From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24039 invoked by alias); 6 Jul 2012 15:09:52 -0000 Received: (qmail 24022 invoked by uid 22791); 6 Jul 2012 15:09:51 -0000 X-SWARE-Spam-Status: No, hits=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_BJ,TW_CX,TW_DC,TW_GX X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 06 Jul 2012 15:09:38 +0000 From: "aschepler at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/53878] New: Abstract class constructors Date: Fri, 06 Jul 2012 15:09:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: aschepler at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-07/txt/msg00621.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53878 Bug #: 53878 Summary: Abstract class constructors Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: aschepler@gmail.com The following code is ill-formed C++03 and well-formed C++11, but g++ does not accept it with the -std=c++0x flag: class Base { public: explicit Base(int); }; class Abstract : virtual public Base { public: Abstract(); virtual ~Abstract() = 0; }; Abstract::Abstract() {} See Standard 2011 section 12.6.2 paragraph 8. "if a given non-static data member or base class is not designated by a mem-initializer-id ... and the entity is not a virtual base class of an abstract class, then ... [if the entity is not a data member with an initializer in the class definition and is not a variant member,] the entity is default-initialized". $ g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/i486-linux-gnu/4.7/lto-wrapper Target: i486-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.1-2' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --enable-targets=all --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu Thread model: posix gcc version 4.7.1 (Debian 4.7.1-2)