From: David Majnemer Date: Thu, 14 Aug 2014 00:49:23 +0000 (+0000) Subject: Sema: Permit nullptr template args in MSVC compat mode X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=30c130110e46b23195e77c39ab1a05bf31abf21c;p=clang Sema: Permit nullptr template args in MSVC compat mode This fixes a regression I caused back in r211766. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215609 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index d81f651368..63581a44db 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -4189,7 +4189,7 @@ isNullPointerValueTemplateArgument(Sema &S, NonTypeTemplateParmDecl *Param, 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. diff --git a/test/Parser/MicrosoftExtensions.cpp b/test/Parser/MicrosoftExtensions.cpp index a35d0695b0..0174ec2f29 100644 --- a/test/Parser/MicrosoftExtensions.cpp +++ b/test/Parser/MicrosoftExtensions.cpp @@ -118,7 +118,7 @@ typedef COM_CLASS_TEMPLATE_REF COM COM_CLASS_TEMPLATE_REF good_template_arg; -COM_CLASS_TEMPLATE 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 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 +struct NullptrArg {}; +NullptrArg a;