https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124199

Halalaluyafail3 <luigighiron at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
            Summary|[13/14/15/16 Regression]    |[13/14/15/16 Regression]
                   |Declaration conditions with |Declaration conditions
                   |array declarator operators  |check for invalid array
                   |are incorrectly rejected    |declarator at the wrong
                   |                            |location

--- Comment #3 from Halalaluyafail3 <luigighiron at gmail dot com> ---
More specifically, this seems to only occur when the outermost declarator
operator is an array declarator. For example:

int main(){
    if(int*(*q)[]=0);
}

This program is correctly accepted. Furthermore, the following is incorrectly
accepted:

int main(){
    if(int*a[]={0});
}

The wording "The declarator shall not specify a function or an array." clearly
makes this invalid, and Clang rejects this. GCC before GCC 9 did not reject
this either. So it seems like the bug is that instead of checking for the
innermost declarator operator it checks the outermost declarator operator.
There is another divergence between GCC and Clang here:

int main(){
    typedef int T[];
    if(T b={0});
}

GCC accepts this and Clang rejects it. From my interpretation of the previously
quoted text the declarator does not specify an array, rather the
decl-specifier-seq specifies the array so it should be accepted. Though I
suppose another interpretation is that specifying an array means it declares an
object to be an array, in which case it should be rejected.

Reply via email to