GCC and Clang disagree about C++17 constexpr lambda captures
Consider this example which declares a variable as constexpr, captures it by copy in a lambda, and declares another constexpr variable which is the result of a constexpr function unwrapping a non-type template parameter from the original variable. #include <utility> template<int I> constexpr auto unwrap(std::integral_constant<int, I>) { return I; } int main() { constexpr auto i = std::integral_constant<int, 42>{}; constexpr auto l = [i]() { constexpr int x = unwrap(i); }; } Clang (trunk) accepts this code. ( wandbox ) GCC (trunk) fails with the following error message ( wandbox ): lambda