Open llvmbot opened 5 years ago
Modified example that demonstrates why it might be a good idea to reject this:
struct test { const int *addr; };
int get();
const test* setup()
{
static constexpr test atest =
{
({ static int inner = get(); &inner; })
};
return &atest;
}
Note that the code generated for setup()
does not include a call to get()
: we're returning the address of an uninitialized static local.
Extended Description
My clang is 9.0.0, and the code is:
clang accepts it, but icc and gcc reject it.
gcc:
icc: