Re: [isocpp-modules] Clarification of visibility rules for friend functions

5 views
Skip to first unread message

Richard Smith

unread,
Sep 24, 2019, 8:55:40 PM9/24/19
to mod...@isocpp.org, David Stone
On Tue, Sep 24, 2019 at 4:04 PM David Stone via Modules <mod...@lists.isocpp.org> wrote:
Is it valid to call `get<0>(my::derived<int>())` from an importing module?

Yes. The base class my::base<int> has a reachable definition, so its friend 'get' is visible to ADL by [basic.lookup.argdep]/4.3.
 
export module my;

namespace my {

template<typename>
struct base {
   template<int>
    friend constexpr auto get(base) {
        return 5;
    }
};


export template<typename T>
struct derived : base<T> {
};

} // namespace my
_______________________________________________
Modules mailing list
Mod...@lists.isocpp.org
Subscription: https://lists.isocpp.org/mailman/listinfo.cgi/modules
Link to this post: http://lists.isocpp.org/modules/2019/09/0740.php
Reply all
Reply to author
Forward
0 new messages