public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105826] New: failure to compile namespace-scope constexpr new-expression
@ 2022-06-02 20:12 mpolacek at gcc dot gnu.org
  2023-05-18 16:39 ` [Bug c++/105826] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-06-02 20:12 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105826
           Summary: failure to compile namespace-scope constexpr
                    new-expression
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

As discussed in
<https://gcc.gnu.org/pipermail/gcc-patches/2022-June/596134.html>, this should
compile in C++20:

struct A
{
  int i;
  constexpr A(int *p): i(*p) { delete p; }
};

constexpr int i = A(new int(42)).i;

but currently we issue

$ ./cc1plus -quiet q.C -std=c++20
q.C:7:34: error: the value of ‘<anonymous>’ is not usable in a constant
expression
    7 | constexpr int i = A(new int(42)).i;
      |                                  ^
q.C:7:31: note: ‘<anonymous>’ was not declared ‘constexpr’
    7 | constexpr int i = A(new int(42)).i;
      |                               ^

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

* [Bug c++/105826] failure to compile namespace-scope constexpr new-expression
  2022-06-02 20:12 [Bug c++/105826] New: failure to compile namespace-scope constexpr new-expression mpolacek at gcc dot gnu.org
@ 2023-05-18 16:39 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-18 16:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-05-18
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

end of thread, other threads:[~2023-05-18 16:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-02 20:12 [Bug c++/105826] New: failure to compile namespace-scope constexpr new-expression mpolacek at gcc dot gnu.org
2023-05-18 16:39 ` [Bug c++/105826] " 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).