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

Richard Smith <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Richard Smith <[email protected]> ---
In order to determine which 'fn' to call, the compiler needs to check
'is_invocable<F&&, T const&>'. As part of checking whether the lambda is
invokable, the compiler needs to check whether it has a valid return type.
Because the lambda has a deduced return type, the operator() must be
instantiated (with 'auto' = 'const int') to deduce that return type. That
instantiation fails as described in the given diagnostic.

So this is a bug in your code, not a bug in Clang (nor in GCC / ICC / MSVC,
which all reject this the same way).

You can fix your code by giving the lambda an explicit return type rather than
a deduced return type:

    instance.fn([](auto& i) -> void {
        i = 0;
    });

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to