public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/47959] New: [C++0x] brace-or-equal-initializer not allowed for static data member of const literal type
@ 2011-03-02 17:34 redi at gcc dot gnu.org
  2011-03-16 20:54 ` [Bug c++/47959] " jason at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2011-03-02 17:34 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [C++0x] brace-or-equal-initializer not allowed for
                    static data member of const literal type
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: redi@gcc.gnu.org


struct Lit { constexpr Lit() {} };

struct L
{
    static const Lit l = Lit();
} ;

init.cc:5:30: error: 'constexpr' needed for in-class initialization of static
data member 'l' of non-integral type

I think the diagnostic is wrong.

[class.static.data] p3 says 

  If a static data member is of const literal type, its declaration in
  the class definition can specify a brace-or-equal-initializer in which
  every initializer-clause that is an assignment-expression is a constant
  expression.

Lit is a literal type, L::l is of const literal type, the initializer is a
constant expression, so the example should be accepted.


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

* [Bug c++/47959] [C++0x] brace-or-equal-initializer not allowed for static data member of const literal type
  2011-03-02 17:34 [Bug c++/47959] New: [C++0x] brace-or-equal-initializer not allowed for static data member of const literal type redi at gcc dot gnu.org
@ 2011-03-16 20:54 ` jason at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: jason at gcc dot gnu.org @ 2011-03-16 20:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jason at gcc dot gnu.org
         Resolution|                            |INVALID

--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> 2011-03-16 20:53:31 UTC ---
That passage is being fixed to match G++ by core issue 1101:
http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_active.html#1101


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

end of thread, other threads:[~2011-03-16 20:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-02 17:34 [Bug c++/47959] New: [C++0x] brace-or-equal-initializer not allowed for static data member of const literal type redi at gcc dot gnu.org
2011-03-16 20:54 ` [Bug c++/47959] " 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).