re PR c++/82022 (constexpr lambda in template context: expression ‘<lambda>’ is not...
authorPaolo Carlini <paolo.carlini@oracle.com>
Mon, 5 Mar 2018 10:19:11 +0000 (10:19 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 5 Mar 2018 10:19:11 +0000 (10:19 +0000)
2018-03-05  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/82022
* g++.dg/cpp1z/constexpr-lambda20.C: New.

From-SVN: r258241

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1z/constexpr-lambda20.C [new file with mode: 0644]

index 63adcbe988e1d45da0babc411641b9f4b60a3776..8e7e53b8546f425a8781031a471bfbc007b65165 100644 (file)
@@ -1,3 +1,8 @@
+2018-03-05  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/82022
+       * g++.dg/cpp1z/constexpr-lambda20.C: New.
+
 2018-03-03  Harald Anlauf  <anlauf@gmx.de>
 
        PR fortran/71085
diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda20.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda20.C
new file mode 100644 (file)
index 0000000..c5109b8
--- /dev/null
@@ -0,0 +1,16 @@
+// PR c++/82022
+// { dg-options -std=c++17 }
+
+template <class T>
+void f2()
+{
+  constexpr bool r = []() constexpr { return false; }();
+  if constexpr (r);
+  if constexpr ([]() constexpr { return false; }());
+}
+
+int main()
+{
+  if constexpr ([]() constexpr { return false; }());
+  f2<int>();
+}