<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 - [clang-cl] Implicit instantiation of template within its own definition inside noexcept of friend member function"
   href="https://bugs.llvm.org/show_bug.cgi?id=47689">47689</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[clang-cl] Implicit instantiation of template within its own definition inside noexcept of friend member function
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>11.0
          </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>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>rixript@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Boost asio the following workaround:
<a href="https://github.com/chriskohlhoff/asio/blob/38fda8d/asio/include/asio/execution/blocking.hpp#L328-L336">https://github.com/chriskohlhoff/asio/blob/38fda8d/asio/include/asio/execution/blocking.hpp#L328-L336</a>

The first one for clang was fixed in 8c98c880. However there remains a
workaround for MSVC compiler.
The latest MSVC (19.27.29112) is able to handle both cases, but clang-cl is
able to handle only the second case.

Consider the following minified example:

    template <typename T>
    struct false_t {
        static constexpr bool value = false;
    };

    template <int I = 0>
    struct S {
        using t = void;
        friend void query() noexcept(false_t<S<>::t>::value) {}
    };

MSVC is able to compile this:

    C:\boost_test>cl /c test.cpp
    Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29112 for x64
    Copyright (C) Microsoft Corporation.  All rights reserved.
    test.cpp

However, clang-cl is unable to compile:

    C:\boost_test>C:\llvm\llvm-11.0.0rc4\bin\clang-cl.exe /c 
    test.cpp
    test.cpp(9,42): error: implicit instantiation of template 'S<0>' within its
own definition
    friend void query() noexcept(false_t<S<>::t>::value) {}
                                         ^
    1 error generated.</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>