public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/30111]  New: Value-initialization of POD base class doesn't initialize members
@ 2006-12-07 17:51 gcc-bugzilla at kayari dot org
  2006-12-07 18:03 ` [Bug c++/30111] " gcc-bugzilla at kayari dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 13+ messages in thread
From: gcc-bugzilla at kayari dot org @ 2006-12-07 17:51 UTC (permalink / raw)
  To: gcc-bugs

#include <iostream>

int main()
{
    struct pod {
        int i;
    };

    struct inherit : pod {
        inherit() : pod() {}
    };

    struct compose {
        compose() : p() {}
        pod p;
    };

    inherit i;
    compose c;

    std::cout << i.i << std::endl;
    std::cout << c.p.i << std::endl;
}

In both cases the pod object is explicitly value-initialized, which according
to 8.5para5 means that "every non-static data member ... is value-initialized"

compose::pod::i is value-initialised, inherit::i is not.  This can be seen from
the values printed out for i.i and by using Purify.

Same result with GCC 4.1.1, 3.4.3, 3.3.4 on Solaris 9, GCC 3.4.3 on AIX 5/3

Valgrind is being weird so I can't test it on Linux, butI don't think it's
platform-dependent.


-- 
           Summary: Value-initialization of POD base class doesn't
                    initialize members
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gcc-bugzilla at kayari dot org
GCC target triplet: sparc-sun-solaris2.9


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


^ permalink raw reply	[flat|nested] 13+ messages in thread
[parent not found: <bug-30111-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2014-02-16 10:02 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-07 17:51 [Bug c++/30111] New: Value-initialization of POD base class doesn't initialize members gcc-bugzilla at kayari dot org
2006-12-07 18:03 ` [Bug c++/30111] " gcc-bugzilla at kayari dot org
2006-12-08  7:27 ` rguenth at gcc dot gnu dot org
2006-12-08  7:35 ` pinskia at gcc dot gnu dot org
2006-12-08 10:36 ` gcc-bugzilla at kayari dot org
2006-12-30 19:40 ` gdr at gcc dot gnu dot org
2007-06-10  2:18 ` pinskia at gcc dot gnu dot org
2007-06-18  1:37 ` jwakely dot gcc at gmail dot com
2008-02-04 16:07 ` rguenth at gcc dot gnu dot org
2009-02-11  5:35 ` jason at gcc dot gnu dot org
2009-02-11 22:39 ` jason at gcc dot gnu dot org
2009-02-11 22:50 ` jason at gcc dot gnu dot org
     [not found] <bug-30111-4@http.gcc.gnu.org/bugzilla/>
2014-02-16 10:02 ` jackie.rosen at hushmail 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).