Page 1 of 1

Noesis 3.2.7 the Delegate operator += for lambdas is not compiled

Posted: 22 Jan 2025, 21:02
by Tomas
Hi,
In any example, let in (Commands sample)
    MainWindow()
    {
        Initialized() += MakeDelegate(this, &MainWindow::OnInitialized);
        Initialized() += [](auto, const auto& e) { }; //C2679

        InitializeComponent();
    }
It doesn't work in Delegate.h
    /// Constructor from functor (lambda)
    template<class F, class = EnableIf<IsInvocable<decltype(&F::operator()), Ret, Args...>::Result>>  // !!!!!!!
    Delegate(const F& f);

Re: Noesis 3.2.7 the Delegate operator += for lambdas is not compiled

Posted: 23 Jan 2025, 00:19
by jsantos
This is intentional. Versions prior to 3.2.7 were too permissive, allowing incorrect parameters and causing crashes or weird compiler errors.

Now, you must explicitly specify the parameters of the delegate::
class MainWindow final: public Window
{
public:
    MainWindow()
    {
        Initialized() += [](BaseComponent*, const EventArgs&)
        {
        };
    }
};