public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "andrew dot stubbs at st dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/29043] Constructor for POD type with const member without member initializer accepted
Date: Wed, 13 Sep 2006 09:23:00 -0000	[thread overview]
Message-ID: <20060913092305.7171.qmail@sourceware.org> (raw)
In-Reply-To: <bug-29043-5394@http.gcc.gnu.org/bugzilla/>



------- Comment #2 from andrew dot stubbs at st dot com  2006-09-13 09:23 -------
(In reply to comment #1)
> As you've written it, class C doesn't have any non-static members.  Struct C::s
> hasn't been declared as a member object of C.  const int i is a member of C::s,
> not C, so C() without member initializers should be acceptable.  

How about this example:

struct S {
  const int i;
};

class C
{
public:
  C() { }    
  S s;
};

void f()
{
  C c;
  S s;
}

This fails at the line `S s;' in f(), but the `C c;' line is accepted silently.

The standard says the requirement applies to data-members *containing* a member
of const-qualified type.


-- 


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


  parent reply	other threads:[~2006-09-13  9:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-12 21:02 [Bug c++/29043] New: " amylaar at gcc dot gnu dot org
2006-09-13  3:00 ` [Bug c++/29043] " fang at csl dot cornell dot edu
2006-09-13  9:23 ` andrew dot stubbs at st dot com [this message]
2006-09-13 16:10 ` bangerth at dealii dot org
2010-04-19 20:03 ` fabien dot chene at gmail dot com
2010-04-20 22:47 ` fabien dot chene at gmail dot com
2010-04-21  9:46 ` redi at gcc dot gnu dot org
2010-04-28  0:03 ` jason at gcc dot gnu dot org
     [not found] <bug-29043-4@http.gcc.gnu.org/bugzilla/>
2010-11-12 14:47 ` fabien.chene at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060913092305.7171.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).