r215609 - Sema: Permit nullptr template args in MSVC compat mode

Richard Smith richard at metafoo.co.uk
Wed Aug 13 18:08:22 PDT 2014


Yes, please.


On Wed, Aug 13, 2014 at 6:03 PM, David Majnemer <david.majnemer at gmail.com>
wrote:

> Should this get merged for the next release?
>
>
> On Wed, Aug 13, 2014 at 5:49 PM, David Majnemer <david.majnemer at gmail.com>
> wrote:
>
>> Author: majnemer
>> Date: Wed Aug 13 19:49:23 2014
>> New Revision: 215609
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=215609&view=rev
>> Log:
>> Sema: Permit nullptr template args in MSVC compat mode
>>
>> This fixes a regression I caused back in r211766.
>>
>> Modified:
>>     cfe/trunk/lib/Sema/SemaTemplate.cpp
>>     cfe/trunk/test/Parser/MicrosoftExtensions.cpp
>>
>> Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=215609&r1=215608&r2=215609&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaTemplate.cpp Wed Aug 13 19:49:23 2014
>> @@ -4189,7 +4189,7 @@ isNullPointerValueTemplateArgument(Sema
>>    if (Arg->isValueDependent() || Arg->isTypeDependent())
>>      return NPV_NotNullPointer;
>>
>> -  if (!S.getLangOpts().CPlusPlus11 || S.getLangOpts().MSVCCompat)
>> +  if (!S.getLangOpts().CPlusPlus11)
>>      return NPV_NotNullPointer;
>>
>>    // Determine whether we have a constant expression.
>>
>> Modified: cfe/trunk/test/Parser/MicrosoftExtensions.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/MicrosoftExtensions.cpp?rev=215609&r1=215608&r2=215609&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/test/Parser/MicrosoftExtensions.cpp (original)
>> +++ cfe/trunk/test/Parser/MicrosoftExtensions.cpp Wed Aug 13 19:49:23 2014
>> @@ -118,7 +118,7 @@ typedef COM_CLASS_TEMPLATE_REF<struct_wi
>>
>>  COM_CLASS_TEMPLATE_REF<int, __uuidof(struct_with_uuid)>
>> good_template_arg;
>>
>> -COM_CLASS_TEMPLATE<int, __uuidof(struct_with_uuid)> bad_template_arg; //
>> expected-error {{non-type template argument of type 'const _GUID' cannot be
>> converted to a value of type 'const GUID *' (aka 'const _GUID *')}}
>> +COM_CLASS_TEMPLATE<int, __uuidof(struct_with_uuid)> bad_template_arg; //
>> expected-error {{non-type template argument of type 'const _GUID' is not a
>> constant expression}}
>>
>>  namespace PR16911 {
>>  struct __declspec(uuid("{12345678-1234-1234-1234-1234567890aB}")) uuid;
>> @@ -357,3 +357,7 @@ void *_alloca(int);
>>  void foo(void) {
>>    __declspec(align(16)) int *buffer = (int *)_alloca(9);
>>  }
>> +
>> +template <int *>
>> +struct NullptrArg {};
>> +NullptrArg<nullptr> a;
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>
>
> _______________________________________________
> 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/20140813/ff245f85/attachment.html>


More information about the cfe-commits mailing list