On Mon, 21 Dec 2020, Uecker, Martin wrote: > diff --git a/gcc/testsuite/gcc.dg/c2x-qual-1.c > b/gcc/testsuite/gcc.dg/c2x-qual-1.c > new file mode 100644 > index 00000000000..058a840e04c > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/c2x-qual-1.c > @@ -0,0 +1,12 @@ > +/* Test that qualifiers are not lost in tertiary operator for pointers to > arrays, PR98397 */ > +/* { dg-do compile } */ > +/* { dg-options "-std=gnu2x" } */ > + > +void foo(void) > +{ > + const int (*u)[1]; > + void *v; > + extern const void *vc; > + extern typeof(1 ? u : v) vc; > + extern typeof(1 ? v : u) vc; > +}
I'd expect c2x-* tests to use -std=c2x not -std=gnu2x. Tests needing -std=gnu2x can be gnu2x-* tests, but you should be able to test the types using _Generic without needing any gnu2x features. c2x-* tests should also use -pedantic or -pedantic-errors unless they are specifically testing something that doesn't work with those options. There should also be tests for cases where code is valid before C2x but invalid in C2x (assignment storing a pointer-to-qualified-array in void *, for example). All the tests should have both c2x-* and c11-* variants so the testsuite verifies that the code is properly handled in C11 mode (warnings with -pedantic, errors with -pedantic-errors, in the cases that are invalid for C11 but valid for C2x). There should also be -Wc11-c2x-compat tests with -std=c2x where appropriate. -- Joseph S. Myers jos...@codesourcery.com