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

* [Bug c++/53878] [C++11] Abstract class constructors
  2012-07-06 15:09 [Bug c++/53878] New: Abstract class constructors aschepler at gmail dot com
@ 2015-09-04 22:46 ` 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
  2 siblings, 0 replies; 4+ messages in thread
From: aschepler at gmail dot com @ 2015-09-04 22:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53878

--- Comment #1 from Andrew Schepler <aschepler at gmail dot com> ---
Created attachment 36293
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36293&action=edit
Abstract class constructors may skip virtual bases

Attached is my attempt at a patch for this issue.  In addition to allowing an
abstract constructor to skip initializing virtual bases, this makes it so that
abstract classes have no "complete" constructors (which could never be called
anyway), only the "base" kind.


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

* [Bug c++/53878] [C++11] Abstract class constructors
  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
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-31 21:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53878

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |7.0

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed in GCC 7+.  I suspect by r7-3590 .

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

* [Bug c++/53878] [C++11] Abstract class constructors
  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
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-31 21:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53878

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> Fixed in GCC 7+.  I suspect by r7-3590 .

pr66443-cxx14-3.C testcase looks like this case.

^ 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).