[llvm-bugs] [Bug 25424] New: A compound literal does not yield an lvalue
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Nov 5 16:02:24 PST 2015
https://llvm.org/bugs/show_bug.cgi?id=25424
Bug ID: 25424
Summary: A compound literal does not yield an lvalue
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: andrey.vul at gmail.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
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
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151106/e7c814bc/attachment.html>
More information about the llvm-bugs
mailing list