Consider:
constexpr int a;
the error message for this is currently:
error: default initialization of an object of const type 'const int'
constexpr int a;
^
= 0which makes very little sense to me. With this patch, the output is instead:
error: constexpr variable 'a' must be initialized by a constant expression
constexpr int a;
^
= 0which is much better. Tells the user exactly what is missing.
For
constexpr int a[];
before this patch, the output is:
error: definition of variable with array type needs an explicit size or an initializer
constexpr int a[];
^The error message is not even true in this case, since _only_ passing a size won't work. It must be initialized by a constant expression, so now the error message is:
error: constexpr variable 'a' must be initialized by a constant expression
constexpr int a[];
^and a fixit hint if a size was provided:
error: constexpr variable 'a' must be initialized by a constant expression
constexpr int a[2];
^
= {}(not sure about that part)