https://bugs.llvm.org/show_bug.cgi?id=38325
Bug ID: 38325
Summary: decltype for lambda capture gives wrong type
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
According to my reading of the http://eel.is/c++draft/expr.prim.id.unqual#2 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, "");
static_assert(decltype(is_const(y))::value, ""); // Fails (OK on GCC)
static_assert(decltype(is_const(z))::value, "");
static_assert(!std::is_const<decltype(x)>::value, "");
static_assert(std::is_const<decltype(y)>::value, ""); // Fails (OK on GCC)
static_assert(std::is_const<decltype(z)>::value, "");
} ();
}
However, two lines marked with "Fails (OK on GCC)" do not pass the asserts.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs