http://llvm.org/bugs/show_bug.cgi?id=21125
Bug ID: 21125
Summary: enable_if diagnostics don't work well with enable_if_t
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++1y
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
Given a program:
#include <string>
#include <type_traits>
class employee {
std::string name_;
public:
template<typename String,
class = typename
std::enable_if<std::is_assignable<std::decay_t<String>,
decltype(name_)>::value>::type >
void set_name(String &&name) {
name_ = std::forward<String>(name);
}
};
int main() {
employee e;
e.set_name(1);
}
The diagnostics helpfully point directly to the condition that causes the
error:
main.cpp:9:46: note: candidate template ignored: disabled by 'enable_if' [with
String = int]
class = typename
std::enable_if<std::is_assignable<std::decay_t<String>,
decltype(name_)>::value>::type >
^
But when enable_if_t is used, the diagnostic loses this helpful info:
/usr/include/c++/v1/type_traits:225:78: note: candidate template ignored:
disabled by 'enable_if' [with String = int]
template <bool _Bp, class _Tp = void> using enable_if_t = typename
enable_if<_Bp, _Tp>::type;
^
--
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