]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/50276 ([C++0x] Wrong "used uninitialized in this function" warning)
authorJason Merrill <jason@gcc.gnu.org>
Tue, 5 Mar 2013 18:58:36 +0000 (13:58 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 5 Mar 2013 18:58:36 +0000 (13:58 -0500)
PR c++/50276
* g++.dg/cpp0x/lambda/lambda-template10.C: New.

From-SVN: r196472

gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template10.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template10.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template10.C
new file mode 100644 (file)
index 0000000..4a80462
--- /dev/null
@@ -0,0 +1,23 @@
+// PR c++/50276
+// { dg-options "-std=c++11 -Wuninitialized" }
+// { dg-do run }
+
+template<typename T>
+unsigned testfun(const T& func)
+{
+  return func();
+}
+
+template<int i>
+unsigned test()
+{
+  if (unsigned value = testfun( [] () { return 0; }))
+    return value;
+  return i;
+}
+
+int main()
+{
+  if (test<42>() != 42)
+    __builtin_abort ();
+}