testsuite: Add more C2x tests
authorJoseph Myers <joseph@codesourcery.com>
Fri, 23 Sep 2022 21:23:01 +0000 (21:23 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Fri, 23 Sep 2022 21:23:01 +0000 (21:23 +0000)
commitd88319de4165cd58764f0611df03179d6ce4d160
tree071b8138b72a07a43c15e1e3155f0206aade9143
parentf5072839c46acd185f40a5692aca06fac4ed6a48
testsuite: Add more C2x tests

There are some new requirements in C2x where GCC already behaves as
required (for all standard versions), where previous standard versions
either had weaker requirements permitting the GCC behavior, or were
arguably defective in what they said in that area.  Add tests that
specifically verify GCC behaves as expected for C2x.  (There may be
further such tests to be added in future for already-supported C2x
features.)

* Compound literals in function parameter lists have automatic storage
  duration.  (This is a case where strictly this wasn't specified by
  previous standard versions, but it seems to make more sense to treat
  this as a defect in those versions than to implement something
  different conditionally for those versions.)

* Concatenation of string literals with different prefixes is a
  constraint violation (previously it was implementation-defined
  whether it was permitted, and GCC did not permit it).

* UCNs above 0x10ffff are a constraint violation; previously they were
  implicitly undefined behavior by virtue of wording about "designates
  the character" referring to code points outside the ISO/IEC 10646
  range; GCC diagnosed such UCNs since commit
  0900e29cdbc533fecf2a311447bbde17f101bbd6 (Sep 2019).  The test I
  added also has more detailed coverage of what lower-valued UCNs are
  accepted.

Tested for x86_64-pc-linux-gnu.

* gcc.dg/c2x-complit-1.c, gcc.dg/c2x-concat-1.c,
gcc.dg/cpp/c2x-ucn-1.c: New tests.
gcc/testsuite/gcc.dg/c2x-complit-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c2x-concat-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/cpp/c2x-ucn-1.c [new file with mode: 0644]