https://llvm.org/bugs/show_bug.cgi?id=23700

            Bug ID: 23700
           Summary: Superfluous instantiations during std::async overload
                    resolution
           Product: libc++
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to