public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/49132] New: [C++0x] Aggregate-initialization rejected for class with const data member
@ 2011-05-23 21:46 daniel.kruegler at googlemail dot com
  2011-05-23 22:37 ` [Bug c++/49132] " jason at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2011-05-23 21:46 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [C++0x] Aggregate-initialization rejected for class
                    with const data member
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: daniel.kruegler@googlemail.com
                CC: jason@redhat.com


gcc 4.7.0 20110521 (experimental) in C++0x mode rejects the following code:

//---
struct A {
 const int m;
};

A a1 = {}; // #1
A a2{};    // #2
//---

The error messages at the lines marked with #1 and #2 are:

"error: uninitialized const member 'A::m'"

The code should be accepted, because the objects undergo
aggregate-initialization. The error message is incorrect, the objects are
initialized.


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

* [Bug c++/49132] [C++0x] Aggregate-initialization rejected for class with const data member
  2011-05-23 21:46 [Bug c++/49132] New: [C++0x] Aggregate-initialization rejected for class with const data member daniel.kruegler at googlemail dot com
@ 2011-05-23 22:37 ` jason at gcc dot gnu.org
  2011-05-23 22:37 ` [Bug c++/49132] [DR 178] " jason at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2011-05-23 22:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-05-23 22:08:46 UTC ---
It's annoying how GCC bugzilla tends not to send mail to people when I add them
to CC even if I also add a comment.  Anyway, Fabien, please take a look at this
bug.


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

* [Bug c++/49132] [DR 178] Aggregate-initialization rejected for class with const data member
  2011-05-23 21:46 [Bug c++/49132] New: [C++0x] Aggregate-initialization rejected for class with const data member daniel.kruegler at googlemail dot com
  2011-05-23 22:37 ` [Bug c++/49132] " jason at gcc dot gnu.org
@ 2011-05-23 22:37 ` jason at gcc dot gnu.org
  2011-05-23 22:40 ` [Bug c++/49132] [4.6/4.7 regression] " jason at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2011-05-23 22:37 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Aggregate-initialization    |[DR 178]
                   |rejected for class with     |Aggregate-initialization
                   |const data member           |rejected for class with
                   |                            |const data member

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> 2011-05-23 22:17:51 UTC ---
This was clarified to be well-formed as part of DR 178.

http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#178


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

* [Bug c++/49132] [4.6/4.7 regression] Aggregate-initialization rejected for class with const data member
  2011-05-23 21:46 [Bug c++/49132] New: [C++0x] Aggregate-initialization rejected for class with const data member daniel.kruegler at googlemail dot com
  2011-05-23 22:37 ` [Bug c++/49132] " jason at gcc dot gnu.org
  2011-05-23 22:37 ` [Bug c++/49132] [DR 178] " jason at gcc dot gnu.org
@ 2011-05-23 22:40 ` jason at gcc dot gnu.org
  2011-05-23 22:43 ` [Bug c++/49132] [C++0x] " jason at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2011-05-23 22:40 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.5.1
            Summary|[C++0x]                     |[4.6/4.7 regression]
                   |Aggregate-initialization    |Aggregate-initialization
                   |rejected for class with     |rejected for class with
                   |const data member           |const data member
      Known to fail|                            |4.6.0, 4.7.0

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2011-05-23 22:11:49 UTC ---
This is a regression relative to 4.5 in C++98/03 mode as well (the a1
declaration).


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

* [Bug c++/49132] [C++0x] Aggregate-initialization rejected for class with const data member
  2011-05-23 21:46 [Bug c++/49132] New: [C++0x] Aggregate-initialization rejected for class with const data member daniel.kruegler at googlemail dot com
                   ` (2 preceding siblings ...)
  2011-05-23 22:40 ` [Bug c++/49132] [4.6/4.7 regression] " jason at gcc dot gnu.org
@ 2011-05-23 22:43 ` jason at gcc dot gnu.org
  2011-05-23 22:48 ` [Bug c++/49132] " jason at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2011-05-23 22:43 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.05.23 22:07:23
                 CC|                            |fabien at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> 2011-05-23 22:07:23 UTC ---
Yes.  process_init_constructor_record shouldn't complain about uninitialized
const members, because within aggregate initialization, members without
explicit initializers are value-initialized.  Fabien?


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

* [Bug c++/49132] Aggregate-initialization rejected for class with const data member
  2011-05-23 21:46 [Bug c++/49132] New: [C++0x] Aggregate-initialization rejected for class with const data member daniel.kruegler at googlemail dot com
                   ` (3 preceding siblings ...)
  2011-05-23 22:43 ` [Bug c++/49132] [C++0x] " jason at gcc dot gnu.org
@ 2011-05-23 22:48 ` jason at gcc dot gnu.org
  2011-05-24  0:42 ` [Bug c++/49132] [DR 178] " redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2011-05-23 22:48 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
      Known to work|4.5.1                       |
            Summary|[4.6/4.7 regression]        |Aggregate-initialization
                   |Aggregate-initialization    |rejected for class with
                   |rejected for class with     |const data member
                   |const data member           |
      Known to fail|                            |2.95, 3.0, 4.0.4

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2011-05-23 22:14:39 UTC ---
Actually it isn't a regression, it's broken as far back as 2.95.


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

* [Bug c++/49132] [DR 178] Aggregate-initialization rejected for class with const data member
  2011-05-23 21:46 [Bug c++/49132] New: [C++0x] Aggregate-initialization rejected for class with const data member daniel.kruegler at googlemail dot com
                   ` (4 preceding siblings ...)
  2011-05-23 22:48 ` [Bug c++/49132] " jason at gcc dot gnu.org
@ 2011-05-24  0:42 ` redi at gcc dot gnu.org
  2011-11-16 13:55 ` fabien at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2011-05-24  0:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-05-23 23:16:02 UTC ---
(In reply to comment #2)
> It's annoying how GCC bugzilla tends not to send mail to people when I add them
> to CC even if I also add a comment.  Anyway, Fabien, please take a look at this
> bug.

GCC bugzilla mails seem to go out in random order with arbitrarily long delays
recently, so the "New" bug mail sometimes appears in the archives several
minutes after the first comment on a bug. very annoying


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

* [Bug c++/49132] [DR 178] Aggregate-initialization rejected for class with const data member
  2011-05-23 21:46 [Bug c++/49132] New: [C++0x] Aggregate-initialization rejected for class with const data member daniel.kruegler at googlemail dot com
                   ` (5 preceding siblings ...)
  2011-05-24  0:42 ` [Bug c++/49132] [DR 178] " redi at gcc dot gnu.org
@ 2011-11-16 13:55 ` fabien at gcc dot gnu.org
  2014-06-24 18:41 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fabien at gcc dot gnu.org @ 2011-11-16 13:55 UTC (permalink / raw)
  To: gcc-bugs

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

fabien at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED


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

* [Bug c++/49132] [DR 178] Aggregate-initialization rejected for class with const data member
  2011-05-23 21:46 [Bug c++/49132] New: [C++0x] Aggregate-initialization rejected for class with const data member daniel.kruegler at googlemail dot com
                   ` (6 preceding siblings ...)
  2011-11-16 13:55 ` fabien at gcc dot gnu.org
@ 2014-06-24 18:41 ` paolo.carlini at oracle dot com
  2014-06-25 14:28 ` paolo at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-06-24 18:41 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|jason at redhat dot com            |
           Assignee|fabien at gcc dot gnu.org          |paolo.carlini at oracle dot com

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Mine.


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

* [Bug c++/49132] [DR 178] Aggregate-initialization rejected for class with const data member
  2011-05-23 21:46 [Bug c++/49132] New: [C++0x] Aggregate-initialization rejected for class with const data member daniel.kruegler at googlemail dot com
                   ` (7 preceding siblings ...)
  2014-06-24 18:41 ` paolo.carlini at oracle dot com
@ 2014-06-25 14:28 ` paolo at gcc dot gnu.org
  2014-06-25 14:29 ` paolo.carlini at oracle dot com
  2014-06-26 17:00 ` paolo.carlini at oracle dot com
  10 siblings, 0 replies; 12+ messages in thread
From: paolo at gcc dot gnu.org @ 2014-06-25 14:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Wed Jun 25 14:27:35 2014
New Revision: 211981

URL: https://gcc.gnu.org/viewcvs?rev=211981&root=gcc&view=rev
Log:
/cp
2014-06-25  Paolo Carlini  <paolo.carlini@oracle.com>

    DR 178
    PR c++/49132
    * typeck2.c (process_init_constructor_record): Do not complain about
    uninitialized const members, because within aggregate-initialization,
    members without explicit initializers are value-initialized.

/testsuite
2014-06-25  Paolo Carlini  <paolo.carlini@oracle.com>

    DR 178
    PR c++/49132
    * g++.dg/cpp0x/aggr1.C: New.
    * g++.dg/cpp0x/aggr2.C: Likewise.
    * g++.dg/init/aggr11.C: Likewise.
    * g++.dg/init/aggr12.C: Likewise.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/aggr1.C
    trunk/gcc/testsuite/g++.dg/cpp0x/aggr2.C
    trunk/gcc/testsuite/g++.dg/init/aggr11.C
    trunk/gcc/testsuite/g++.dg/init/aggr12.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/typeck2.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/49132] [DR 178] Aggregate-initialization rejected for class with const data member
  2011-05-23 21:46 [Bug c++/49132] New: [C++0x] Aggregate-initialization rejected for class with const data member daniel.kruegler at googlemail dot com
                   ` (8 preceding siblings ...)
  2014-06-25 14:28 ` paolo at gcc dot gnu.org
@ 2014-06-25 14:29 ` paolo.carlini at oracle dot com
  2014-06-26 17:00 ` paolo.carlini at oracle dot com
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-06-25 14:29 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
           Assignee|paolo.carlini at oracle dot com    |unassigned at gcc dot gnu.org
   Target Milestone|---                         |4.10.0

--- Comment #9 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed for 4.10.0.


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

* [Bug c++/49132] [DR 178] Aggregate-initialization rejected for class with const data member
  2011-05-23 21:46 [Bug c++/49132] New: [C++0x] Aggregate-initialization rejected for class with const data member daniel.kruegler at googlemail dot com
                   ` (9 preceding siblings ...)
  2014-06-25 14:29 ` paolo.carlini at oracle dot com
@ 2014-06-26 17:00 ` paolo.carlini at oracle dot com
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-06-26 17:00 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppluzhnikov at google dot com

--- Comment #10 from Paolo Carlini <paolo.carlini at oracle dot com> ---
*** Bug 61581 has been marked as a duplicate of this bug. ***


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

end of thread, other threads:[~2014-06-26 17:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-23 21:46 [Bug c++/49132] New: [C++0x] Aggregate-initialization rejected for class with const data member daniel.kruegler at googlemail dot com
2011-05-23 22:37 ` [Bug c++/49132] " jason at gcc dot gnu.org
2011-05-23 22:37 ` [Bug c++/49132] [DR 178] " jason at gcc dot gnu.org
2011-05-23 22:40 ` [Bug c++/49132] [4.6/4.7 regression] " jason at gcc dot gnu.org
2011-05-23 22:43 ` [Bug c++/49132] [C++0x] " jason at gcc dot gnu.org
2011-05-23 22:48 ` [Bug c++/49132] " jason at gcc dot gnu.org
2011-05-24  0:42 ` [Bug c++/49132] [DR 178] " redi at gcc dot gnu.org
2011-11-16 13:55 ` fabien at gcc dot gnu.org
2014-06-24 18:41 ` paolo.carlini at oracle dot com
2014-06-25 14:28 ` paolo at gcc dot gnu.org
2014-06-25 14:29 ` paolo.carlini at oracle dot com
2014-06-26 17:00 ` paolo.carlini at oracle dot com

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