From f210b3b3723c32bfdaafa149ca5697e83e0a9479 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 20 Feb 2018 18:00:23 +0100 Subject: [PATCH] re PR c++/84488 (Incorrect "set but not used" warning for static_cast(double)) PR c++/84488 * g++.dg/warn/Wunused-var-30.C: New test. From-SVN: r257850 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/warn/Wunused-var-30.C | 11 +++++++++++ 2 files changed, 16 insertions(+) create mode 100644 gcc/testsuite/g++.dg/warn/Wunused-var-30.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8eb50db7478..d6cedecf44a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-02-20 Jakub Jelinek + + PR c++/84488 + * g++.dg/warn/Wunused-var-30.C: New test. + 2018-02-20 Richard Sandiford PR tree-optimization/84419 diff --git a/gcc/testsuite/g++.dg/warn/Wunused-var-30.C b/gcc/testsuite/g++.dg/warn/Wunused-var-30.C new file mode 100644 index 00000000000..e95e120e656 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wunused-var-30.C @@ -0,0 +1,11 @@ +// PR c++/84488 +// { dg-do compile } +// { dg-options "-Wunused-but-set-variable" } + +int +foo () +{ + enum E { A, B, C, D }; + double r = 1.0; // { dg-bogus "set but not used" } + return static_cast(r); +} -- 2.30.2