From 598f25beb6950459ed5cd7488dad0d612e29e5d6 Mon Sep 17 00:00:00 2001 From: Gabriel Dos Reis Date: Sat, 11 Aug 2001 20:21:55 +0000 Subject: [PATCH] New test from PR #3230 From-SVN: r44807 --- gcc/testsuite/g++.dg/warn/return-reference.C | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 gcc/testsuite/g++.dg/warn/return-reference.C diff --git a/gcc/testsuite/g++.dg/warn/return-reference.C b/gcc/testsuite/g++.dg/warn/return-reference.C new file mode 100644 index 000000000000..9c367ea48ce4 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/return-reference.C @@ -0,0 +1,21 @@ +// { dg-do compile } + +const int* bar(); + +const int& +foo1() +{ + static int empty; + const int* x = bar(); + return (x ? *x : empty); +} + +const int& +foo2() +{ + static int empty; + const int* x = bar(); + const int& r = (x ? *x : empty); + return (r); +} +