summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/warn/Wunused-5.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/warn/Wunused-5.C')
-rw-r--r--gcc/testsuite/g++.dg/warn/Wunused-5.C19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/warn/Wunused-5.C b/gcc/testsuite/g++.dg/warn/Wunused-5.C
new file mode 100644
index 000000000..8a8d9d280
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wunused-5.C
@@ -0,0 +1,19 @@
+/* PR opt/14288 */
+/* { dg-do compile } */
+/* { dg-options "-O -Wall" } */
+
+volatile int sink;
+extern int foo(int);
+
+struct S
+{
+ int x;
+
+ S() { x = foo(0); }
+ ~S() { sink = x; }
+};
+
+int test(bool p)
+{
+ return p ? foo(S().x) : 0; /* { dg-bogus "uninitialized" } */
+}