<html>
    <head>
      <base href="https://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 --- - Superfluous instantiations during std::async overload resolution" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23700&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=glmlgren1rpJrJtUCPLUYp7XGAhX_-TGNfD_f802Y8M&s=6v6fgpQ9WxyGqqCx5aLyCJP4AqtkFpOwmt4c_1Q3NzI&e=">23700</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Superfluous instantiations during std::async overload resolution
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>All Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>kaballo86@hotmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu, mclow.lists@gmail.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following snippet triggers a compilation failure:

    #include <future>
    #include <type_traits>

    struct foo {
      template <class ...Ts>
      void operator()(Ts...) {}
    };

    struct bar {
      template <class T>
      struct result {
        static_assert(!std::is_integral<T>::value, "nope");
        using type = T;
      };

      template <class T>
      typename result<T>::type operator()(T v) { return v; }
    };

    int main() {
      std::async(foo(), bar(), 42);
    }

During overload resolution, the `async` overload taking a `launch` policy as
first argument is trying to instantiate `bar::operator()(int)` declaration,
resulting in an error that's not in the immediate context.

This snippet might be ill-formed given [temp.inst]/7

<span class="quote">> If the overload resolution process can determine the correct function to call without instantiating a class template definition, it is unspecified whether that instantiation actually takes place.</span ></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>