public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53878] New: Abstract class constructors
@ 2012-07-06 15:09 aschepler at gmail dot com
  2015-09-04 22:46 ` [Bug c++/53878] [C++11] " aschepler at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: aschepler at gmail dot com @ 2012-07-06 15:09 UTC (permalink / raw)
  To: gcc-bugs

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)


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-31 21:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-06 15:09 [Bug c++/53878] New: Abstract class constructors aschepler at gmail dot com
2015-09-04 22:46 ` [Bug c++/53878] [C++11] " aschepler at gmail dot com
2021-07-31 21:14 ` pinskia at gcc dot gnu.org
2021-07-31 21:30 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).