<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 - std::variant compiles with exception handling"
href="https://bugs.llvm.org/show_bug.cgi?id=46342">46342</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>std::variant compiles with exception handling
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>10.0
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Standards Issues
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nmmm@e-nick.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>This code includes exception handling. It must not include it, since both int
and double are exception safe types:
#include <variant>
int main(){
using V = std::variant<int, double>;
V a = 5;
V b = 5.6;
a.swap(b);
}
Problem might be in standard library, since this does not emit exception handle
code:
#include <variant>
template<class T>
void sw(T &a, T &b){
auto c = a;
a = b;
b = c;
}
int main(){
using V = std::variant<int, double>;
V a = 5;
V b = 5.6;
sw(a, b);
}
<a href="https://stackoverflow.com/questions/62404209/why-this-stdvariant-code-includes-exception-handling">https://stackoverflow.com/questions/62404209/why-this-stdvariant-code-includes-exception-handling</a></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>