Created attachment 42073 [details] source code in a template context a constexpr lambda doesn't seem to be able to be constexpr evaluated and its result is not constexpr. if constexpr ([]() constexpr {return true;}()); //expression ‘<lambda>’ is not a constant expression constexpr bool r = []() constexpr {return true;}(); if constexpr (r); //"r" used in its own initializer
Created attachment 42074 [details] log error
Author: paolo Date: Mon Mar 5 10:19:11 2018 New Revision: 258241 URL: https://gcc.gnu.org/viewcvs?rev=258241&root=gcc&view=rev Log: 2018-03-05 Paolo Carlini <paolo.carlini@oracle.com> PR c++/82022 * g++.dg/cpp1z/constexpr-lambda20.C: New. Added: trunk/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda20.C Modified: trunk/gcc/testsuite/ChangeLog
Fixed in trunk. Of course this requires -std=c++17