[LLVMbugs] [Bug 9882] New: noexcept sometimes returns unexpected value
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon May 9 13:46:38 PDT 2011
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: unassignedclangbugs at nondot.org
ReportedBy: hhinnant at apple.com
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
#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.
More information about the llvm-bugs
mailing list