summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-const2.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/lambda/lambda-const2.C')
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-const2.C15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-const2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-const2.C
new file mode 100644
index 0000000000..d2457d6491
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-const2.C
@@ -0,0 +1,15 @@
+// PR c++/52026
+// { dg-options "-std=c++11 -O" }
+// { dg-do run }
+
+template<bool B>
+int func() {
+ const int constVal1 = B ? 100 : -100;
+ const int constVal = constVal1;
+ return [] { return constVal; }();
+}
+
+int main() {
+ if (func<true>() != 100)
+ __builtin_abort ();
+}