Is it legal to declare an array of size 0 as per the C++17 standard?
No, nothing has changed in C++17 to allow zero sized arrays. Per the C++17 draft [dcl.array]/1
In a declaration T D where D has the form
D1 [ constant-expressionopt] attribute-specifier-seqopt
[...]If the constant-expression is present, it shall be a converted constant expression of type std::size_t and its value shall be greater than zero.[...]
emphasis mine
What you are seeing here is a non standard compiler extension that is allowing you to compile the code.
You can disable these extensions by using the -pedantic
compiler flag.