<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - enable_if diagnostics don't work well with enable_if_t"
   href="http://llvm.org/bugs/show_bug.cgi?id=21125">21125</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>enable_if diagnostics don't work well with enable_if_t
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++1y
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>seth.cantrell@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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;
                                                                             ^</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>