http://llvm.org/bugs/show_bug.cgi?id=9882
Summary: noexcept sometimes returns unexpected value
Product: clang
Version: trunk
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: C++0x
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
#include <iostream>
template <class T, T v>
struct integral_constant
{
static const T value1 = v;
};
template <class T>
T&& declval() noexcept;
template <class T, class U>
struct is_nothrow_assignable
: public integral_constant<bool, noexcept(declval<T>() = declval<U>())>
{
static const bool value2 = noexcept(declval<T>() = declval<U>());
};
int main()
{
std::cout << is_nothrow_assignable<int&, int&>::value1 << '\n';
std::cout << is_nothrow_assignable<int&, int&>::value2 << '\n';
}
I'm getting:
0
1
I'm expecting:
1
1
It seems like the noexcept wrongly evaluates to false when used in specifying
the base class.
With this fixed, I think I can implement the nothrow type traits without
compiler support as long as the associated non-nothrow type traits are working.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs