gcc/testsuite/ChangeLog:
* g++.dg/warn/Wunused-var-35.C: New test.
From-SVN: r268503
+2019-02-03 Martin Sebor <msebor@redhat.com>
+
+ PR c++/44648
+ * g++.dg/warn/Wunused-var-35.C: New test.
+
2019-02-03 Richard Biener <rguenther@suse.de>
PR debug/87295
--- /dev/null
+// PR c++/44648 - missing -Wunused warning on a const variable in if statement
+// { dg-do compile }
+// { dg-options "-Wunused" }
+
+int main()
+{
+ bool b0 = 1; // { dg-warning "\\\[-Wunused-variable\\\]" }
+ const bool b00 = 1; // { dg-warning "\\\[-Wunused-variable\\\]" }
+ if (bool b1 = 1) // { dg-warning "\\\[-Wunused-variable\\\]" }
+ return 0;
+ else
+ return 1;
+
+ if (const bool b2 = 1) // { dg-warning "\\\[-Wunused-variable\\\]" "bug" { xfail c++98_only } }
+ return 0;
+ else
+ return 1;
+}
+