public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101588] New: rejects valid constexpr when binding from a constexpr function
@ 2021-07-23  2:17 pinskia at gcc dot gnu.org
  2021-07-23  2:22 ` [Bug c++/101588] rejects valid constexpr when binding from a constexpr function and initializer_list pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-23  2:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101588
           Summary: rejects valid constexpr when binding from a constexpr
                    function
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Split out from PR 66287.

Take:
struct T { int i; };
constexpr T copy(const T& v) { return v; }
constexpr const auto& r = T{42};
constexpr const auto& c = copy(r);
int main() {}
----- CUT ----
This should be accepted by GCC but currently is rejected:
<source>:11:33: error: modification of '<temporary>' is not a constant
expression
   11 | constexpr const auto& c = copy(r);
      |                                 ^

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

end of thread, other threads:[~2023-02-10  0:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-23  2:17 [Bug c++/101588] New: rejects valid constexpr when binding from a constexpr function pinskia at gcc dot gnu.org
2021-07-23  2:22 ` [Bug c++/101588] rejects valid constexpr when binding from a constexpr function and initializer_list pinskia at gcc dot gnu.org
2021-07-23  2:34 ` [Bug c++/101588] [DR2126] " pinskia at gcc dot gnu.org
2023-02-09  0:23 ` mpolacek at gcc dot gnu.org
2023-02-10  0:07 ` mpolacek 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).