| | | | --- | --- | | Bugzilla Link | [47714](https://llvm.org/bz47714) | | Resolution | DUPLICATE | | Resolved on | Oct 21, 2021 06:09 | | Version | trunk | | OS | All | | Reporter | LLVM Bugzilla Contributor | | CC | @AaronBallman,@efriedma-quic,@zygoloid,@synopsys-sig-compiler-frontends | ## Extended Description The following example is given both in the current C++ draft standard: http://eel.is/c++draft/expr.const#11 and the immediate functions proposal: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1073r3.html consteval int f() { return 42; } consteval auto g() { return f; } consteval int h(int (*p)() = g()) { return p(); } constexpr int r = h(); // OK and although examples not normative AFAICT this is meant to be valid but clang rejects this although gcc does accept it, see the following godbolt: https://godbolt.org/z/WW7G9q
Extended Description
The following example is given both in the current C++ draft standard: http://eel.is/c++draft/expr.const#11 and the immediate functions proposal: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1073r3.html
consteval int f() { return 42; }
consteval auto g() { return f; }
consteval int h(int (*p)() = g()) { return p(); }
constexpr int r = h(); // OK
and although examples not normative AFAICT this is meant to be valid but clang rejects this although gcc does accept it, see the following godbolt: https://godbolt.org/z/WW7G9q