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

Reid Kleckner rnk at google.com
Mon Nov 11 18:27:01 PST 2013


Thanks!  Committed in r194441.


On Mon, Nov 11, 2013 at 7:44 AM, Will Wilson <will at indefiant.com> wrote:

> *ping* Any chance of getting this patch in before the 3.4 release branch?
>
> Thanks!
> Will.
>
>
> On 7 November 2013 08:06, Will Wilson <will at indefiant.com> wrote:
>
>> Thanks Richard. Updated patch with comment attached ready for committing
>> (if it looks acceptable).
>>
>> Cheers,
>> Will.
>>
>>
>> On 7 November 2013 00:25, Richard Smith <richard at metafoo.co.uk> wrote:
>>
>>> LGTM. But please add a comment to AST/Expr.cpp near the
>>> isCXX98IntegralConstantExpr check to say that we follow the C++98 rules in
>>> Microsoft mode.
>>>
>>>
>>> On Wed, Nov 6, 2013 at 5:31 AM, Will Wilson <will at indefiant.com> wrote:
>>>
>>>> Thanks David! Patch attached...
>>>>
>>>>
>>>> On 6 November 2013 14:25, David Majnemer <david.majnemer at gmail.com>wrote:
>>>>
>>>>> There doesn't seem to see a patch attached.
>>>>>
>>>>>
>>>>> On Wed, Nov 6, 2013 at 2:50 AM, Will Wilson <will at indefiant.com>wrote:
>>>>>
>>>>>> Hi Richard,
>>>>>>
>>>>>> Only just had another crack at this MS mode issue. I've updated the
>>>>>> patch and added your example to the test case. The new version correctly
>>>>>> mirrors MSVC's handling in clang with C++11 mode active.
>>>>>>
>>>>>> All tests pass and clang-format applied. Let me know what you think.
>>>>>>
>>>>>> Cheers,
>>>>>> Will.
>>>>>>
>>>>>>
>>>>>> On 28 August 2013 03:11, Will Wilson <will at indefiant.com> wrote:
>>>>>>
>>>>>>> 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.*
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> *Indefiant Ltd.*
>>>>>>
>>>>>> _______________________________________________
>>>>>> cfe-commits mailing list
>>>>>> cfe-commits at cs.uiuc.edu
>>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> *Indefiant Ltd.*
>>>>
>>>
>>>
>>
>>
>> --
>> *Indefiant Ltd.*
>>
>
>
>
> --
> *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/20131111/fc5c72be/attachment.html>


More information about the cfe-commits mailing list