In ubuntu gcc 8.0:
void bar(){}
constexpr int foo(int a)
{
if (a <=0 )
bar();
return 1;
}
int main()
{
int a1[foo(-1)]; //will give a compile error, which is expected,
//since non-constexpr function is not allowd in constexpr context
}
But in the following test:
int main()
{
int a2[foo(1)]; //no compile error
}
Here, bar is non-constexpr function. I am wondering why non-constexpr function is allowed in constexpr context although in this test it doesn't get called.