Proposal: allow `if consteval`

29 views
Skip to first unread message

Victor Vianna

unread,
Jan 13, 2026, 12:41:16 PM (8 days ago) Jan 13
to cxx
Here is a snippet that shows why this feature is useful (TIL).
And here is a CL to allow it and add some usages - mostly to verify the feature works and make the code more concise, since it is not particularly useful in those instances IIUC.

-- Victor

Jeremy Roman

unread,
Jan 13, 2026, 2:56:06 PM (7 days ago) Jan 13
to Victor Vianna, cxx
Makes sense to me. We don't use consteval much yet, so it's kinda neutral until we do, but might as well allow it and maybe it'll become increasingly useful.

--
You received this message because you are subscribed to the Google Groups "cxx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cxx+uns...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CANFyMwz-g9dkqjCuFhAoR4cc2h_9%3DVVv-O0DWsXwMtE8kmR7dA%40mail.gmail.com.

Elly

unread,
Jan 13, 2026, 3:00:51 PM (7 days ago) Jan 13
to Jeremy Roman, Victor Vianna, cxx
I'm also fine with this, although I can't say I've ever wished for consteval personally.

-- elly

Jan Wilken Dörrie

unread,
Jan 14, 2026, 6:08:31 AM (7 days ago) Jan 14
to cxx, Elly, Victor Vianna, cxx, Jeremy Roman
+1. This removes a bit gotcha with std::is_constant_evaluated(), which needs to be used with a runtime if (rather than constexpr if) to be meaningful: https://en.cppreference.com/w/cpp/types/is_constant_evaluated.html#Notes
Reply all
Reply to author
Forward
0 new messages