<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 - exception specification does not match error for extra parentheses (Derived from libstdc++ trunk)"
href="https://bugs.llvm.org/show_bug.cgi?id=41705">41705</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>exception specification does not match error for extra parentheses (Derived from libstdc++ trunk)
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>peter.smith@linaro.org
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>I've derived this from trunk libstdc++ which as of r270650 with commit Use
_GLIBCXX_NOEXCEPT_IF for std::swap is now failing to compile with clang due to
a
error: exception specification in declaration does not match previous
declaration
clash with type_traits.
It looks like the error is caused by an extra set of parentheses introduced by
the _GLIBCXX_NOEXCEPT_IF macro. I can reproduce with the stripped down example:
cat t.cpp
template <class T> struct Foo {
enum { value = 0 };
};
template <> struct Foo<bool> {
enum { value = 1 };
};
template <class T>
void f1(T a) noexcept(Foo<T>::value);
template <class T>
void f1(T a) noexcept((Foo<T>::value)) {}
clang -c t.cpp
t.cpp:14:6: error: exception specification in declaration does not match
previous declaration
void f1(T a) noexcept((Foo<T>::value)) {}
^
t.cpp:11:6: note: previous declaration is here
void f1(T a) noexcept(Foo<T>::value);
^
The error doesn't seem to be provoked if I just use noexcept(true) and
noexcept((true)).
My knowledge of the C++ standard isn't good enough to know whether the extra
parentheses allow the compiler to error in this case as the expressions aren't
identical?
I'm intending to raise a PR on libstdc++ to see if I can get the type_traits to
precisely match move.h.</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>