[LLVMbugs] [Bug 21125] New: enable_if diagnostics don't work well with enable_if_t
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Oct 1 15:31:29 PDT 2014
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: unassignedclangbugs at nondot.org
Reporter: seth.cantrell at gmail.com
CC: llvmbugs at cs.uiuc.edu
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141001/d9795957/attachment.html>
More information about the llvm-bugs
mailing list