[v3 PATCH] PR libstdc++/87855
Jonathan Wakely
jwakely@redhat.com
Mon Nov 19 13:01:00 GMT 2018
On 19/11/18 12:28 +0000, Jonathan Wakely wrote:
>On 15/11/18 14:00 +0200, Ville Voutilainen wrote:
>>Tested on Linux-PPC64. Ok for trunk? Backports?
>
>One problem ...
>
>>--- /dev/null
>>+++ b/libstdc++-v3/testsuite/20_util/optional/assignment/9.cc
>>@@ -0,0 +1,98 @@
>>+// { dg-options "-std=gnu++17" }
>>+// { dg-do compile }
>
>This needs to be:
>
>// { dg-do compile { target c++17 } }
>
>Otherwise it FAILs with DejaGnu 1.5.2 and older when using something
>like --target_board=unix/-std=c++14 (because old versions of DejaGnu
>override the explicit dg-options in the testcase with the
>--target_board options).
>
>If you use { target c++17 } then when the old DejaGnu overrides your
>{ dg-options "-std=gnu++17" } setting it still correctly skips the
>test for older dialects, instead of getting a FAIL.
I'm wrong about that. The check_effective_target_c++* checks in
gcc/testsuite/lib/target-supports.exp say:
# This assumes that the default for the compiler is $cxx_default, and that
# there will never be multiple -std= arguments on the command line.
So if dg-options adds -std=gnu++17 then the testsuite thinks that
option is in effect, even if there's a later -std=c++14 on the final
command-line that came from --target_board. Drat. So using an old
DejaGnu means setting -std=* via --target_board will give lots of
FAILures.
But having the { target c++17 } present is still preferable, as it
makes the test's requirements explicit, and makes the test more
futureproof. If we later change the compiler default to -std=gnu++17
then we'll want to remove the { dg-options "-std=gnu++17" } from these
tests, so that they can also be tested in C++2a and C++2b modes. If we
do that, we'll need the { target c++17 } so it doesn't get tested for
c++14 and older.
More information about the Libstdc++
mailing list