[LLVMbugs] [Bug 23700] New: Superfluous instantiations during std::async overload resolution

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri May 29 14:42:43 PDT 2015


            Bug ID: 23700
           Summary: Superfluous instantiations during std::async overload
           Product: libc++
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kaballo86 at hotmail.com
                CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
    Classification: Unclassified

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

> 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.

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/20150529/84a7b556/attachment.html>

More information about the llvm-bugs mailing list