[committed] Add testcase for PR c++/84488

Message ID 20180220170200.GG5867@tucnak
State New
Headers show
Series
  • [committed] Add testcase for PR c++/84488
Related show

Commit Message

Jakub Jelinek Feb. 20, 2018, 5:02 p.m.
Hi!

This testcase got fixed in r257155 aka PR83942, but unlike
the PR83942 testcase which regressed during 8.x stage1 this one used
to fail before too, so I think it is worth adding another testcase for it.

Tested on x86_64-linux, committed to trunk as obvious.

2018-02-20  Jakub Jelinek  <jakub@redhat.com>

	PR c++/84488
	* g++.dg/warn/Wunused-var-30.C: New test.


	Jakub

Patch

--- gcc/testsuite/g++.dg/warn/Wunused-var-30.C.jj	2018-02-20 17:53:26.539480455 +0100
+++ gcc/testsuite/g++.dg/warn/Wunused-var-30.C	2018-02-20 17:53:18.419481675 +0100
@@ -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<E>(r);
+}