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: unassignedclangb...@nondot.org
Reporter: zhong...@pku.org.cn
CC: dgre...@apple.com, llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs