C++ Logo

SG10

Advanced search

Subject: Re: [isocpp-core] Feature-test macro for ADL calls with template arguments?
From: Marc Mutz (marc.mutz_at_[hidden])
Date: 2020-06-09 02:36:49


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


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