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
* [Bug c++/101588] rejects valid constexpr when binding from a constexpr function and initializer_list 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 ` pinskia at gcc dot gnu.org 2021-07-23 2:34 ` [Bug c++/101588] [DR2126] " pinskia at gcc dot gnu.org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2021-07-23 2:22 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101588 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Note clang was only fixed in clang 12. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/101588] [DR2126] rejects valid constexpr when binding from a constexpr function and initializer_list 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 ` 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 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2021-07-23 2:34 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101588 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|rejects valid constexpr |[DR2126] rejects valid |when binding from a |constexpr when binding from |constexpr function and |a constexpr function and |initializer_list |initializer_list Alias| |DR2126 --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- GCC implements DR2126 mostly except when the type is intialized like: T{42} . ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/101588] [DR2126] rejects valid constexpr when binding from a constexpr function and initializer_list 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 3 siblings, 0 replies; 5+ messages in thread From: mpolacek at gcc dot gnu.org @ 2023-02-09 0:23 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101588 Marek Polacek <mpolacek at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Last reconfirmed| |2023-02-09 CC| |mpolacek at gcc dot gnu.org Status|UNCONFIRMED |NEW --- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> --- This came up again in bug 107079. The static_assert should pass after fixing bug 107079 but doesn't because we don't fully implement the -- a temporary object of non-volatile const-qualified literal type whose lifetime is extended ([class.temporary]) to that of a variable that is usable in constant expressions, or bullet. struct X { const X* x = this; }; constexpr const X& x = X{}; static_assert(x.x == &x); ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/101588] [DR2126] rejects valid constexpr when binding from a constexpr function and initializer_list 2021-07-23 2:17 [Bug c++/101588] New: rejects valid constexpr when binding from a constexpr function pinskia at gcc dot gnu.org ` (2 preceding siblings ...) 2023-02-09 0:23 ` mpolacek at gcc dot gnu.org @ 2023-02-10 0:07 ` mpolacek at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: mpolacek at gcc dot gnu.org @ 2023-02-10 0:07 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101588 --- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> --- When fixing this, please adjust g++.dg/cpp0x/constexpr-nsdmi2.C. ^ 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).