<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Wrong static_assert on type of underlying_type<memory_order>"
href="https://bugs.llvm.org/show_bug.cgi?id=40977">40977</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Wrong static_assert on type of underlying_type<memory_order>
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</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>release blocker
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>davide@freebsd.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>diogo.sampaio@arm.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=21570" name="attach_21570" title="Small reproducer">attachment 21570</a> <a href="attachment.cgi?id=21570&action=edit" title="Small reproducer">[details]</a></span>
Small reproducer
In the file include/atomic
typedef enum memory_order {
memory_order_relaxed, memory_order_consume, memory_order_acquire,
memory_order_release, memory_order_acq_rel, memory_order_seq_cst
} memory_order;
static_assert((is_same<underlying_type<memory_order>::type,
unsigned>::value), "Underlying type differs from unsigned unexpectedly");
when compiling with "g++ -std=c++11 -fshort-enums"
the underlying type reduces to unsigned char, and the assert fails.
--
A quick fix would be set the last value to something that won't fit in a
uchar...
memory_order_seq_cst = 0xFFFFFFFF</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>