Why can I call a non-constexpr function inside a constexpr function?
Consider the following code: #include <stdio.h> constexpr int f() { return printf("a side effect!\n"); } int main() { char a[f()]; printf("%zd\n", sizeof a); } I would have expected the compiler to complain about the call to printf inside f , because f is supposed to be constexpr , but printf is not. Why does the program compile and print 15 ? Shafik Yaghmour The program is ill-formed and requires no diagnostic according to the C++11 draft standard section 7.1.5 The constexpr specifier paragraph 5 which says: For a constexpr function, if no function argument values exist such that the function