C++ Logo

SG10

Advanced search

Subject: Re: [isocpp-core] Feature-test macro for ADL calls with template arguments?
From: Barry Revzin (barry.revzin_at_[hidden])
Date: 2020-06-09 09:41:05


On Tue, Jun 9, 2020 at 2:37 AM Marc Mutz via Core <core_at_[hidden]>
wrote:

> On 2020-06-08 22:11, John Spicer via Core wrote:
> > I don’t recall if a feature test macro was discussed for this.
> >
> > At the time, I think I would have thought one was not needed, but that
> > could be wrong.
> >
> > There is a workaround of sorts. If you add any function template with
> > the same name and that will be found by normal lookup, then ADL will
> > be done for the function template call with the explicit argument
> > list.
> >
> >> namespace N {
> >>
> >> struct A { };
> >>
> >> template <typename T>
> >>
> >> T func(const A&) { return T(); }
> >>
> >> }
> >>
> >> template <class T, int x[-sizeof(T)]> void func(); // something
> >> uncallable
> >>
> >> void f() {
> >>
> >> N::A a;
> >>
> >> func<int>(a);
> >>
> >> }
> >
> > Which is not to say that we shouldn’t add a macro for this.
>
> Would I totally be going overboard if I suggested that merged papers
> either a) change a feature macro (incl. adding one) or b) document
> workarounds that users would have to take instead? A simple "none
> needed" shouldn't be enough, IMHO.
>
> Thanks,
> Marc
>

I think this sounds like a good idea. I've generally not been very good at
documenting SG-10 policy in our document - it currently doesn't say
anything about what papers should say about feature tests nor when to
provide them. I should get on that..

Barry



SG10 list run by sg10-owner@lists.isocpp.org