Closed as not planned
Description
Bugzilla Link | 38325 |
Version | trunk |
OS | Linux |
CC | @apolukhin,@dwblaikie,@egorpugin,@zygoloid |
Extended Description
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
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.