On Wed, Dec 13, 2023 at 08:51:16AM +0100, Richard Biener wrote: > On Tue, 12 Dec 2023, Peter Bergner wrote: > > > On 12/12/23 8:36 PM, Jason Merrill wrote: > > > This test is failing for me below C++17, I think you need > > > > > > // { dg-do compile { target c++17 } } > > > or > > > // { dg-require-effective-target c++17 } > > > > Sorry about that. Should we do the above or should we just add > > -std=c++17 to dg-options? ...or do we need to do both? > > Just do the above, the C++ testsuite iterates over all standards, > adding -std=c++17 would just run that 5 times. But the above > properly skips unsupported cases.
I believe if one uses explicit -std=gnu++17 or -std=c++17 in dg-options then it will not iterate: # If the testcase specifies a standard, use that one. # If not, run it under several standards, allowing GNU extensions # if there's a dg-options line. if ![search_for $test "-std=*++"] { and otherwise how many times exactly it iterates depends on what the user asked for or what effective target is there (normally the default is to iterate 4 times (98,14,17,20), one can use e.g. GXX_TESTSUITE_STDS=98,11,14,17,20,23,26 to iterate 7 times, or the default also changes if c++23, c++26 or c++11_only effective targets are present somewhere in the test. But sure, if the test is valid in C++17, 20, 23, 26, then // { dg-do compile { target c++17 } } is best (unless the test is mostly language version independent and very expensive to compile or run). Jakub