[PATCH] Fix: Relax nullptr C++11 rules in ms-mode
Will Wilson
will at indefiant.com
Tue Aug 27 18:11:54 PDT 2013
Thanks for the review (and catching the fail on my part)!
MSVC accepts your templated example without complaint. The patched clang
asserts in EvalAddr() in SemaChecking.cpp after being called by
Sema::CheckReturnStackAddr() with "EvalAddr only works on pointers" using
your example case.
Do you have some ideas on how best to support this facet of MSVC behavior
without uglifying the code too much?
Thanks,
Will.
On 27 August 2013 22:04, Richard Smith <richard at metafoo.co.uk> wrote:
> Please use isCXX98IntegralConstantExpr, not isIntegerConstantExpr, in
> C++11 + MicrosoftMode. (Take a look at how we behaved prior to r183883.) We
> *really* don't want to use full constexpr evaluation when determining
> whether an expression is a null pointer constant.
>
> Also, this patch tries to evaluate value-dependent potential null pointer
> constants in C++11 + MicrosoftMode. That's not OK, and will sometimes
> assert. How should we behave here? Does MSVC accept this:
>
> template<int N> int *f() { return N; }
> int *p = f<0>();
>
> ?
>
>
> On Tue, Aug 27, 2013 at 10:05 AM, Will Wilson <will at indefiant.com> wrote:
>
>> Hi All,
>>
>> This patch uses the more relaxed integer expression codepath in
>> Expr::isNullPointerConstant() when MicrosoftMode is enabled, this reflects
>> MSVC behavior and is required to compile various cases I've come across in
>> MSVC targeted code.
>>
>> Test case included. Built and tested against latest code. Please review
>> and commit if possible.
>>
>> Thanks!
>> Will.
>>
>> --
>> *Indefiant Ltd.*
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>>
>
--
*Indefiant Ltd.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130828/a5f6fe5f/attachment.html>
More information about the cfe-commits
mailing list