[PATCH] __attribute__((enable_if)) and non-overloaded member functions

George Burgess via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 16 15:00:11 PDT 2015


Sure. :)  Review is based off the attachment I grabbed from here:
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20150824/136904.html

A few nits:
- test/Sema/enable_if.cpp line 24: Please use __attribute__(( instead of
__attribute((
- Can we have a similar test for a function that returns an Incomplete?

George

On Wed, Sep 16, 2015 at 1:30 PM, Nick Lewycky <nlewycky at google.com> wrote:

> +gbiv, would you be able to review this?
> On Sep 14, 2015 7:42 AM, "Ettore Speziale" <speziale.ettore at gmail.com>
> wrote:
>
>> Ping
>>
>> > Gently ping.
>> >
>> >> On Aug 26, 2015, at 2:40 PM, Ettore Speziale <
>> speziale.ettore at gmail.com> wrote:
>> >>
>> >> Forward to the right ML:
>> >>
>> >>>> Sorry about the extreme delay. This patch slipped through the
>> cracks, and I only noticed it again when searching my email for enable_if.
>> Committed in r245985! In the future, please feel free to continue pinging
>> weekly!
>> >>>
>> >>> NP, thank you for committing the patch.
>> >>>
>> >>> Unfortunately it contains a little error in the case of no candidate
>> has been found. For instance consider the following test case:
>> >>>
>> >>> struct Incomplete;
>> >>>
>> >>> struct X {
>> >>> void hidden_by_argument_conversion(Incomplete n, int m = 0)
>> __attribute((enable_if(m == 10, "chosen when 'm' is ten")));
>> >>> };
>> >>>
>> >>> x.hidden_by_argument_conversion(10);
>> >>>
>> >>> I would expect to get an error about Incomplete, as the compiler
>> cannot understand how to convert 10 into an instance of Incomplete. However
>> right now the enable_if diagnostic is emitted, thus masking the more useful
>> message about Incomplete.
>> >>>
>> >>> The attached patch solved the problem by delaying the point where the
>> enable_if diagnostic is issued.
>> >>>
>> >>> Thanks,
>> >>> Ettore Speziale
>> >>
>> >>
>> >> <enable_if.diff>
>> >
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150916/bca71ea3/attachment.html>


More information about the cfe-commits mailing list