This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/53878] New: Abstract class constructors
- From: "aschepler at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 06 Jul 2012 15:09:37 +0000
- Subject: [Bug c++/53878] New: Abstract class constructors
- Auto-submitted: auto-generated
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)