<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Work around CWG issue 1558 (guarantee SFINAE when using `void_t`)"
   href="https://bugs.llvm.org/show_bug.cgi?id=33655">33655</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Work around CWG issue 1558 (guarantee SFINAE when using `void_t`)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>vittorio.romeo@outlook.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>In both libstdc++ and libc++ `void_t` is currently implemented as:

    template <class...> using void_t = void;

Due to a CWG issue (#1558), unused parameters in alias templates are not
guaranteed to ensure SFINAE and could be ignored:
<a href="http://open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#1558">http://open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#1558</a>

This causes code like this to surprisingly fail to compile:

    struct One { using x = int; };
    struct Two { using y = int; };

    template <typename T, std::void_t<typename T::x>* = nullptr>
    void func() {}
    template <typename T, std::void_t<typename T::y>* = nullptr>
    void func() {}

    int main() { func<One>(); }

There's a workaround for this issue available on cppreference. I propose to use
it to implement `void_t` to guarantee SFINAE-friendliness:

    template<typename... Ts> struct make_void { typedef void type;};
    template<typename... Ts> using void_t = typename make_void<Ts...>::type;

From:
<a href="http://en.cppreference.com/w/cpp/types/void_t">http://en.cppreference.com/w/cpp/types/void_t</a>

Context/more information:
<a href="https://stackoverflow.com/questions/44845945">https://stackoverflow.com/questions/44845945</a></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>