public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52366] New: [c++11] static constexpr function cant initialize static constexpr
@ 2012-02-23 22:15 trashyankes at wp dot pl
  2012-02-23 23:02 ` [Bug c++/52366] " redi at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: trashyankes at wp dot pl @ 2012-02-23 22:15 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52366
           Summary: [c++11] static constexpr function cant initialize
                    static constexpr
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: trashyankes@wp.pl


gcc version 4.7.0 20120203 (experimental) (niXman build)

code:
---------------------------
---------------------------


class A
{
    static constexpr int func() { return 0; }
    static constexpr int i = func(); 
    //^--- error: field initializer is not constant
};


---------------------------
---------------------------


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

* [Bug c++/52366] [c++11] static constexpr function cant initialize static constexpr
  2012-02-23 22:15 [Bug c++/52366] New: [c++11] static constexpr function cant initialize static constexpr trashyankes at wp dot pl
@ 2012-02-23 23:02 ` redi at gcc dot gnu.org
  2012-02-25 16:43 ` trashyankes at wp dot pl
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2012-02-23 23:02 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-02-23 23:01:06 UTC ---
dup of PR 52315 ?


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

* [Bug c++/52366] [c++11] static constexpr function cant initialize static constexpr
  2012-02-23 22:15 [Bug c++/52366] New: [c++11] static constexpr function cant initialize static constexpr trashyankes at wp dot pl
  2012-02-23 23:02 ` [Bug c++/52366] " redi at gcc dot gnu.org
@ 2012-02-25 16:43 ` trashyankes at wp dot pl
  2012-03-13 11:31 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: trashyankes at wp dot pl @ 2012-02-25 16:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from trashyankes at wp dot pl 2012-02-25 14:46:33 UTC ---
(In reply to comment #1)
> dup of PR 52315 ?

after long thoughts, its indeed, dup of PR 52315.


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

* [Bug c++/52366] [c++11] static constexpr function cant initialize static constexpr
  2012-02-23 22:15 [Bug c++/52366] New: [c++11] static constexpr function cant initialize static constexpr trashyankes at wp dot pl
  2012-02-23 23:02 ` [Bug c++/52366] " redi at gcc dot gnu.org
  2012-02-25 16:43 ` trashyankes at wp dot pl
@ 2012-03-13 11:31 ` paolo.carlini at oracle dot com
  2012-07-17 20:32 ` richardvoigt at gmail dot com
  2014-08-02  2:48 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-03-13 11:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-03-13 11:30:29 UTC ---
Dup.

*** This bug has been marked as a duplicate of bug 52315 ***


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

* [Bug c++/52366] [c++11] static constexpr function cant initialize static constexpr
  2012-02-23 22:15 [Bug c++/52366] New: [c++11] static constexpr function cant initialize static constexpr trashyankes at wp dot pl
                   ` (2 preceding siblings ...)
  2012-03-13 11:31 ` paolo.carlini at oracle dot com
@ 2012-07-17 20:32 ` richardvoigt at gmail dot com
  2014-08-02  2:48 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: richardvoigt at gmail dot com @ 2012-07-17 20:32 UTC (permalink / raw)
  To: gcc-bugs

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

Ben Voigt <richardvoigt at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |richardvoigt at gmail dot
                   |                            |com

--- Comment #4 from Ben Voigt <richardvoigt at gmail dot com> 2012-07-17 20:32:26 UTC ---
No, this is not a duplicate.

This code involves a *brace-or-equal-initializer*, the code in 52315 does not,
and there are special rules for brace-or-equal-initializers in section 9.2 of
the Standard.  In particular, the class definition is complete inside the
initializer, although it isn't complete inside the array bounds in 52315.

"Within the class member-specification, the class is regarded as complete
within function bodies, default arguments, exception-specifications, and
brace-or-equal-initializers for non-static data members (including such things
in nested classes)."

Since this is a static data member, the exception doesn't apply, and this code
may in fact be invalid, but it isn't the same case as the other defect report.


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

* [Bug c++/52366] [c++11] static constexpr function cant initialize static constexpr
  2012-02-23 22:15 [Bug c++/52366] New: [c++11] static constexpr function cant initialize static constexpr trashyankes at wp dot pl
                   ` (3 preceding siblings ...)
  2012-07-17 20:32 ` richardvoigt at gmail dot com
@ 2014-08-02  2:48 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-08-02  2:48 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |q.gcc@rsn-tech.co.uk

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 61993 has been marked as a duplicate of this bug. ***


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

end of thread, other threads:[~2014-08-02  2:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-23 22:15 [Bug c++/52366] New: [c++11] static constexpr function cant initialize static constexpr trashyankes at wp dot pl
2012-02-23 23:02 ` [Bug c++/52366] " redi at gcc dot gnu.org
2012-02-25 16:43 ` trashyankes at wp dot pl
2012-03-13 11:31 ` paolo.carlini at oracle dot com
2012-07-17 20:32 ` richardvoigt at gmail dot com
2014-08-02  2:48 ` pinskia 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).