A compound literal does not yield an lvalue #25798
Labels
bugzilla
Issues migrated from bugzilla
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
invalid
Resolved as invalid, i.e. not a bug
Extended Description
Given
template <class A, class B> struct IsSame { static constexpr bool value = false; constexpr operator bool () const { return false; } };
template struct IsSame<A,A> { static constexpr bool value = true; constexpr operator bool () const { return true; } };
static_assert(IsSame<decltype(((const char []){ "string"})), const char (&) [7]>::value, "cxl1");
the test-case should pass, since C99/11 states in 6.5.2.5p4 that compound literals return lvalues. Clang preserves the prvalue-ness of the string literal.
Invocation:
clang++ -std=c++11 aa.cc
Clang version:
gentoo-x64 ~ # clang++ -v
clang version 3.8.0 (6215dbd9a8bf16e34b9b7a0cfda3d17e629a2d8d) (331a8c8)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Selected GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/5.1.0
The text was updated successfully, but these errors were encountered: