According to the wg21.link/P0588R1 and Richard Smith's words from https://bugs.llvm.org//show_bug.cgi?id=38325#c1 the following code should compile: #include <type_traits> #include <cassert> constexpr std::true_type is_const(int const &) { return {}; } constexpr std::false_type is_const(int &) { return {}; } int main() { int x = 0; [y = x, x] { const int z = 0; assert(is_const(x)); // OK assert(is_const(y)); // OK assert(is_const(z)); // OK static_assert(decltype(is_const(x))::value, ""); // Fails static_assert(decltype(is_const(y))::value, ""); static_assert(decltype(is_const(z))::value, ""); static_assert(!std::is_const<decltype(x)>::value, ""); static_assert(!std::is_const<decltype(y)>::value, ""); // Fails static_assert(std::is_const<decltype(z)>::value, ""); } (); } However, two lines marked with "Fails" do not pass the asserts in -std=c++2a mode.
I thought we already had a bug report for this, but I don't see it linked to the PR 54367 meta-bug.
Confirmed.
*** Bug 110752 has been marked as a duplicate of this bug. ***