public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/113127] New: Unexpected error: '<anonymous>' was not declared 'constexpr'
@ 2023-12-24 12:13 fchelnokov at gmail dot com
  2023-12-24 16:15 ` [Bug c++/113127] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: fchelnokov at gmail dot com @ 2023-12-24 12:13 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113127
           Summary: Unexpected error: '<anonymous>' was not declared
                    'constexpr'
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

This constexpr variable definition

    constexpr bool b = ( delete [][]{ return new int[2]; }(), true );

is accepted in Clang and MSVC. But GCC complains:

    <source>:1:64: error: the value of '<anonymous>' is not usable in a
constant 
    <source>:1:56: note: '<anonymous>' was not declared 'constexpr'

Online demo: https://godbolt.org/z/ovso3neEr

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

* [Bug c++/113127] Unexpected error: '<anonymous>' was not declared 'constexpr'
  2023-12-24 12:13 [Bug c++/113127] New: Unexpected error: '<anonymous>' was not declared 'constexpr' fchelnokov at gmail dot com
@ 2023-12-24 16:15 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-12-24 16:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
           Keywords|                            |rejects-valid
   Last reconfirmed|                            |2023-12-24

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed,
Just to show it is unrelated to lambdas I defined it as a constexpr function:
constexpr auto g() {return new int[2];}
constexpr bool b1 = ( delete []g(), true );

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

end of thread, other threads:[~2023-12-24 16:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-24 12:13 [Bug c++/113127] New: Unexpected error: '<anonymous>' was not declared 'constexpr' fchelnokov at gmail dot com
2023-12-24 16:15 ` [Bug c++/113127] " 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).