public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54922] New: [C++11][DR 1359] constexpr constructors require initialization of all union members
@ 2012-10-13 17:36 daniel.kruegler at googlemail dot com
  2012-10-13 20:54 ` [Bug c++/54922] " daniel.kruegler at googlemail dot com
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2012-10-13 17:36 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 54922
           Summary: [C++11][DR 1359] constexpr constructors require
                    initialization of all union members
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: daniel.kruegler@googlemail.com


gcc 4.8.0 20120930 (experimental) compiled with the flags

-Wall -pedantic -std=c++11

rejects the following code:

//----------------
lass nullable_int
{
  bool init_;
  union {
    unsigned char for_value_init;
    int value_;
  };
public:
  constexpr nullable_int() : init_(false), for_value_init() {}
};
//----------------

"main.cpp||In constructor 'constexpr nullable_int::nullable_int()':|
main.cpp|9|error: uninitialized member 'nullable_int::<anonymous>' in
'constexpr' constructor|"

This prevents a very reasonable use-case, namely the creation of a literal type
that contains an anonymous union member.


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

end of thread, other threads:[~2013-03-09 22:16 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-13 17:36 [Bug c++/54922] New: [C++11][DR 1359] constexpr constructors require initialization of all union members daniel.kruegler at googlemail dot com
2012-10-13 20:54 ` [Bug c++/54922] " daniel.kruegler at googlemail dot com
2012-10-20 23:05 ` paolo.carlini at oracle dot com
2012-10-20 23:21 ` paolo.carlini at oracle dot com
2012-10-20 23:31 ` paolo.carlini at oracle dot com
2012-10-22 12:43 ` paolo.carlini at oracle dot com
2012-10-23 23:43 ` paolo at gcc dot gnu.org
2012-10-23 23:44 ` paolo.carlini at oracle dot com
2012-11-07 11:05 ` paolo.carlini at oracle dot com
2012-11-07 11:16 ` paolo.carlini at oracle dot com
2012-11-07 11:16 ` paolo at gcc dot gnu.org
2013-02-06  9:34 ` paolo.carlini at oracle dot com
2013-02-15  1:28 ` jason at gcc dot gnu.org
2013-02-15 11:23 ` paolo.carlini at oracle dot com
2013-02-15 19:38 ` jason at gcc dot gnu.org
2013-03-09 22:16 ` 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).