Suppose class foo
which contains as member a statically allocated array.
class foo
{
private:
char d_chars[5];
public:
foo();
};
Is there any compiler flag that can produce a warning if the initializer list has a different size rather than the size of the array?
For example, the following it may be syntactically valid, but perhaps the developer forgot to add all the necessary initializers.
foo::foo() :
d_chars{'A', 'B', 'C', 'D'}
On the other hand, I know that if the initializer list exceeds the size of the array, the compiler gracefully will produce an error.