<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 - defaulted destructor makes defaulted copy constructor non-constexpr"
href="https://bugs.llvm.org/show_bug.cgi?id=38143">38143</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>defaulted destructor makes defaulted copy constructor non-constexpr
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mclow.lists@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Consider this code:
class span {
public:
using pointer = const int *;
constexpr span() : __data{nullptr} {}
constexpr span (const span&) noexcept = default;
constexpr span& operator=(const span&) noexcept = default;
~span() noexcept = default;
constexpr pointer data() const noexcept { return __data; }
private:
pointer __data;
};
When compiled with a recent clang [clang version 7.0.0 (trunk 336548)],
(-std=c++2a) it gives an error:
junk.cpp:8:5: error: defaulted definition of copy assignment operator is not
constexpr
constexpr span& operator=(const span&) noexcept = default;
^
However, if I switch the order of the two lines to:
~span() noexcept = default;
constexpr span& operator=(const span&) noexcept = default;
then it compiles w/o error.
However, I believe that it should compile w/o error in *both* cases.</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>