<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - A compound literal does not yield an lvalue"
href="https://llvm.org/bugs/show_bug.cgi?id=25424">25424</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>A compound literal does not yield an lvalue
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>andrey.vul@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>