On 26 May 2015 at 13:20, Ettore Speziale <[email protected]> wrote:

> Hello,
>
> the attached patch fixes the case where __attribute__((enable_if)) is
> sticked to a member function with no overloads. It seems that in these case
> clang does not execute the code about overload resolution which contains
> the check about __attribute__((enable_if)). Hence it would be possible to
> use a function protected by __attribute__((enable_if)) even if the
> __attribute__((enable_if)) predicate is false.
>

Good catch!

I think this will cause the enable_if expression to be evaluated multiple
times if the expression is not dependent but appertains to a function
template, such as:

  template <typename T> void foo(int i, T t) __attribute__((enable_if(i==0,
""))) {}

I'm not sure how to fix that without hoisting it up to ActOnCallExpr? Could
you check whether this is a real problem?

Nick
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to