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 <[email protected]> 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 <[email protected]> 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
>> [email protected]
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>>
>


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

Reply via email to