Weird behaviour constexpr with std::initializer_list
问题 I am trying to understand why the compiler is complaining here: // cexpr_test.cpp #include <initializer_list> constexpr int test_cexpr(std::initializer_list<const char*> x) { return (int) (*x.begin())[0]; // ensuring the value isn't optimized out. } int main() { constexpr int r1 = test_cexpr({ "why does this work," }); constexpr std::initializer_list<const char*> broken { "but this doesn't?" }; constexpr int r2 = test_cexpr(broken); return r1 + r2; } The message produced when compiled with g+