Today someone asked me to help to make a VC++ project compiling with G++ and I stumbled across this line:
static char data[constexpr(sizeof(T))];
(of course it was inside a template function with a template parameter named T).
I don't own a C++ standard but according to cppreference:
Syntax
sizeof( type ) (1)
sizeof expression (2)
Both versions are constant expressions of type std::size_t.
So what is the point on telling VC++ that sizeof() is expected to be constexpr?
Try it: https://rextester.com/VIWP36674.
Works on VC but fails for G++ as expected.
Another option to try: https://godbolt.org/z/DnioLS
Works on VC up to 19.10. Seems to be fixed on 19.14 so I conclude it was really a quirk, but even then, someone must have had a reason to write such code...