public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/50965] New: C++11 Non static member initializer are not run when class is initialized with {}
@ 2011-11-02 17:31 ogoffart at kde dot org
  2011-11-02 17:33 ` [Bug c++/50965] " ogoffart at kde dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ogoffart at kde dot org @ 2011-11-02 17:31 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50965
           Summary: C++11 Non static member initializer are not run when
                    class is initialized with {}
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ogoffart@kde.org


Using g++ (GCC) 4.7.0 20111031 (experimental)


struct A { int i = 42; };
int main() {
   A a{};
   std::cout << a.i << std::endl; // shows 0
   std::cout << A{}.i << std::endl; // shows 0
}


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

* [Bug c++/50965] C++11 Non static member initializer are not run when class is initialized with {}
  2011-11-02 17:31 [Bug c++/50965] New: C++11 Non static member initializer are not run when class is initialized with {} ogoffart at kde dot org
@ 2011-11-02 17:33 ` ogoffart at kde dot org
  2011-11-02 17:42 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ogoffart at kde dot org @ 2011-11-02 17:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Olivier Goffart <ogoffart at kde dot org> 2011-11-02 17:33:26 UTC ---
Created attachment 25691
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25691
Suggested patch


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

* [Bug c++/50965] C++11 Non static member initializer are not run when class is initialized with {}
  2011-11-02 17:31 [Bug c++/50965] New: C++11 Non static member initializer are not run when class is initialized with {} ogoffart at kde dot org
  2011-11-02 17:33 ` [Bug c++/50965] " ogoffart at kde dot org
@ 2011-11-02 17:42 ` pinskia at gcc dot gnu.org
  2011-11-02 17:43 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-11-02 17:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-11-02 17:42:05 UTC ---
Is there a reason why you are removing:
-  A a2 = { 24 };
-  if (a2.i != 24) return 2;

>From the testcase?


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

* [Bug c++/50965] C++11 Non static member initializer are not run when class is initialized with {}
  2011-11-02 17:31 [Bug c++/50965] New: C++11 Non static member initializer are not run when class is initialized with {} ogoffart at kde dot org
  2011-11-02 17:33 ` [Bug c++/50965] " ogoffart at kde dot org
  2011-11-02 17:42 ` pinskia at gcc dot gnu.org
@ 2011-11-02 17:43 ` pinskia at gcc dot gnu.org
  2011-11-02 18:13 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-11-02 17:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-11-02 17:42:23 UTC ---
Also patches goto gcc-patches@.


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

* [Bug c++/50965] C++11 Non static member initializer are not run when class is initialized with {}
  2011-11-02 17:31 [Bug c++/50965] New: C++11 Non static member initializer are not run when class is initialized with {} ogoffart at kde dot org
                   ` (2 preceding siblings ...)
  2011-11-02 17:43 ` pinskia at gcc dot gnu.org
@ 2011-11-02 18:13 ` paolo.carlini at oracle dot com
  2011-11-04 17:16 ` jason at gcc dot gnu.org
  2011-11-04 17:17 ` jason at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-11-02 18:13 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-11-02 18:12:57 UTC ---
Let's add Jason in CC, maybe he wants to commit (a variant of) the patch at
once. But really, patches should always go to the mailing list.


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

* [Bug c++/50965] C++11 Non static member initializer are not run when class is initialized with {}
  2011-11-02 17:31 [Bug c++/50965] New: C++11 Non static member initializer are not run when class is initialized with {} ogoffart at kde dot org
                   ` (3 preceding siblings ...)
  2011-11-02 18:13 ` paolo.carlini at oracle dot com
@ 2011-11-04 17:16 ` jason at gcc dot gnu.org
  2011-11-04 17:17 ` jason at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2011-11-04 17:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> 2011-11-04 17:15:14 UTC ---
Author: jason
Date: Fri Nov  4 17:15:02 2011
New Revision: 180965

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=180965
Log:
    PR c++/50965
    * class.c (check_field_decls): NSDMI makes a class non-aggregate.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/class.c
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/cpp0x/nsdmi1.C


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

* [Bug c++/50965] C++11 Non static member initializer are not run when class is initialized with {}
  2011-11-02 17:31 [Bug c++/50965] New: C++11 Non static member initializer are not run when class is initialized with {} ogoffart at kde dot org
                   ` (4 preceding siblings ...)
  2011-11-04 17:16 ` jason at gcc dot gnu.org
@ 2011-11-04 17:17 ` jason at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2011-11-04 17:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> 2011-11-04 17:16:38 UTC ---
Patch applied to trunk, thanks!


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

end of thread, other threads:[~2011-11-04 17:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-02 17:31 [Bug c++/50965] New: C++11 Non static member initializer are not run when class is initialized with {} ogoffart at kde dot org
2011-11-02 17:33 ` [Bug c++/50965] " ogoffart at kde dot org
2011-11-02 17:42 ` pinskia at gcc dot gnu.org
2011-11-02 17:43 ` pinskia at gcc dot gnu.org
2011-11-02 18:13 ` paolo.carlini at oracle dot com
2011-11-04 17:16 ` jason at gcc dot gnu.org
2011-11-04 17:17 ` jason 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).