So I started writing a blog post explaining constexpr & co., but turns out that it's even more cursed than I initially thought.
const char *g() { return "dynamic"; }
constexpr const char *f(bool p) { return p ? "static" : g(); }
compiles, i.e. constexpr-ness is "duck-typed". 💀
Quote Tweet
C++ quiz time!
Without checking, does the following code compile:
constexpr int f(int x) { return x; }
constexpr int g(int x) {
constexpr int fx = f(x);
return fx;
}
Show this poll
1
1
4

