[PATCH] Fix: Relax nullptr C++11 rules in ms-mode

Richard Smith richard at metafoo.co.uk
Tue Aug 27 13:04:45 PDT 2013


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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130827/682afe07/attachment.html>


More information about the cfe-commits mailing list