Skip to content

INIT_NOTIFYING_PROPERTY should qualify its access to m_propertyChanged #659

Description

@dunhor

Filing this as a follow up to #657. Will submit a PR once that one is merged.

TL;DR, the intended usage is something like:

struct foo : winrt::implements<...>, wil::notify_property_changed_base<foo>
{
    wil::single_threaded_notifying_property<int> MyProperty;
    Test() : INIT_NOTIFYING_PROPERTY(MyProperty, 42) {}
};

This has a problem if foo is a class template since notify_property_changed_base uses CRTP. E.g. now consider:

template <typename T>
struct foo : winrt::implements<...>, wil::notify_property_changed_base<foo<T>>
{
    wil::single_threaded_notifying_property<int> MyProperty;
    Test() : INIT_NOTIFYING_PROPERTY(MyProperty, 42) {}
};

notify_property_changed_base is now dependent on the template argument T and therefore name lookup won't "look inside" of notify_property_changed_base when trying to resolve unqualified names. Since m_propertyChanged is a member of notify_property_changed_base, access needs to be prefixed with something like this-> for proper two phase name lookup to resolve the name correctly.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions