public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52369] New: Const-qualified non-class base member and defaulted default constructor
@ 2012-02-24 11:35 ai.azuma at gmail dot com
  2012-02-24 14:06 ` [Bug c++/52369] " fabien at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ai.azuma at gmail dot com @ 2012-02-24 11:35 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52369

             Bug #: 52369
           Summary: Const-qualified non-class base member and defaulted
                    default constructor
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ai.azuma@gmail.com


Created attachment 26740
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26740
Output of -v option and preprocessed file

The following ill-formed code is wrongly accepted by GCC 4.7.0 20120218
(experimental).

////////////////////
class B
{
private:
  int const v_;
};

class D
  : public B
{};

int main()
{
  D d;
}
////////////////////

B's default constructor is implicitly-declared and has no ctor-initializer. So,
B::v_ is not designated by any mem-initializer-id and subject to
default-initialization. However, default-initialization of a const-qualified
non-class type is ill-formed. Therefore, the use of B's constructor is
ill-formed (and it should be defined as deleted in -std=c++11 mode), and the
use of D's is also ill-formed.

N.B. A similar (but a bit different) problem seems to have been resolved in
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29043 .


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

end of thread, other threads:[~2014-03-28 15:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-24 11:35 [Bug c++/52369] New: Const-qualified non-class base member and defaulted default constructor ai.azuma at gmail dot com
2012-02-24 14:06 ` [Bug c++/52369] " fabien at gcc dot gnu.org
2012-02-24 15:21 ` redi at gcc dot gnu.org
2014-03-26 21:34 ` fabien at gcc dot gnu.org
2014-03-28 15:36 ` fabien 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).