Given template <class A, class B> struct IsSame { static constexpr bool value = false; constexpr operator bool () const { return false; } }; template <class A> 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) (331a8c8a870f582385e659dc8785c7ba522136f5) 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
sorry, invocation is clang++ -std=c++11 -c Alternately, adding `int main(){}` to the testcase should suffice. Otherwise, there's the linker error about missing `main`. :)
Compound literals are not part of C++. Clang allows them as an extension, with the following semantics: (T){init} means the same thing as T{init} Thus the compound literal, in this case, a prvalue of type 'const char[7]'.