#include <array>
#include <initializer_list>
constexpr int foo = 42;
constexpr int bar() { return foo; }
int main()
{
constexpr std::array<int, 1> a = { bar() }; // OK
constexpr std::initializer_list<int> b = { foo }; // OK
constexpr std::initializer_list<int> c = { bar() }; // ERROR
}
I2luY2x1ZGUgPGFycmF5PgojaW5jbHVkZSA8aW5pdGlhbGl6ZXJfbGlzdD4KCmNvbnN0ZXhwciBpbnQgZm9vID0gNDI7CmNvbnN0ZXhwciBpbnQgYmFyKCkgeyByZXR1cm4gZm9vOyB9CgppbnQgbWFpbigpCnsKICAgIGNvbnN0ZXhwciBzdGQ6OmFycmF5PGludCwgMT4gYSA9IHsgYmFyKCkgfTsgLy8gT0sKICAgIGNvbnN0ZXhwciBzdGQ6OmluaXRpYWxpemVyX2xpc3Q8aW50PiBiID0geyBmb28gfTsgLy8gT0sKICAgIGNvbnN0ZXhwciBzdGQ6OmluaXRpYWxpemVyX2xpc3Q8aW50PiBjID0geyBiYXIoKSB9OyAvLyBFUlJPUgp9Cg==
prog.cpp: In function ‘int main()’:
prog.cpp:9:46: warning: missing braces around initializer for ‘std::array<int, 1u>::value_type [1] {aka int [1]}’ [-Wmissing-braces]
prog.cpp:11:54: error: ‘const std::initializer_list<int>{((const int*)(&<anonymous>)), 1u}’ is not a constant expression
prog.cpp:9:34: warning: unused variable ‘a’ [-Wunused-variable]
prog.cpp:10:42: warning: unused variable ‘b’ [-Wunused-variable]
prog.cpp:11:42: warning: unused variable ‘c’ [-Wunused-variable]