[llvm-bugs] [Bug 38141] New: declaration has a different exception specifier
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jul 11 18:22:48 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=38141
Bug ID: 38141
Summary: declaration has a different exception specifier
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: zhonghao at pku.org.cn
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
The code is as follows:
template < typename > struct traits;
template < typename T > struct X
{
X & operator = (X &&) noexcept (traits < T >::foo ());
};
template < typename T >
X < T > &
X < T >::operator = (X &&) noexcept (traits < T >::bar ())
{
return *this;
}
clang++ accepts the code, but g++ rejects it:
1reducedtestcasefromg++.dgcpp0xnoexcept28.C.cpp:10:1: error: declaration of
'X<T>& X<T>::operator=(X<T>&&) noexcept (traits<T>::bar())' has a different
exception specifier
X < T >::operator = (X &&) noexcept (traits < T >::bar ())
^~~~~~~
1reducedtestcasefromg++.dgcpp0xnoexcept28.C.cpp:5:7: note: from previous
declaration 'X<T>& X<T>::operator=(X<T>&&) noexcept (traits<T>::foo())'
X & operator = (X &&) noexcept (traits < T >::foo ());
^~~~~~~~
This code looks invalid, right?
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180712/e839f79c/attachment.html>
More information about the llvm-bugs
mailing list