consteval Questions

1

Is there any difference between constexpr and consteval ? consteval int x1 = 2; constexpr int x2 = 5; Is it better to use constexpr than consteval?
Delay asked 16/10, 2020 at 19:55

2

Solved

clang(trunk) gives an error for the following code: consteval void f() {} int main() { f(); // error: call to consteval function 'f' is not a constant expression // note: subobject of type 'vo...
Pharmacopsychosis asked 11/8, 2020 at 19:15

1

In the code below, if here() stops being consteval (either full RT, or constexpr), then line() is the line of invocation of f() inside main(). But with consteval it's the definition of f(). Where d...
Prostrate asked 29/6, 2020 at 12:46

1

Solved

I am working with some code in which constexpr functions are used which I currently refactor to be consteval whenever possible. inline constexpr auto example() noexcept { /*...*/ } As I understa...
Punctual asked 27/2, 2020 at 15:14

2

Solved

This might be a stupid question, but I am confused. I had a feeling that an immediate (consteval) function has to be executed during compile time and we simply cannot see its body in the binary. ...
Oaxaca asked 19/10, 2019 at 17:28

1

Solved

There is a very neat property of constant expressions in C++: their evaluation cannot have undefined behavior (7.7.4.7): An expression e is a core constant expression unless the evaluation of e, f...
Tula asked 18/10, 2019 at 16:14

3

Solved

I am trying to dig into implications of a function being inline and stumbled upon this issue. Consider this small program (demo): /* ---------- main.cpp ---------- */ void other(); constexpr int ...
Ebarta asked 18/10, 2019 at 14:35

1

Solved

Apparently, consteval is going to be a keyword in C++20. The cppreference page for it is currently blank. What is it going to be and how does it relate to constexpr?
Beginner asked 17/11, 2018 at 1:13

© 2022 - 2024 — McMap. All rights reserved.