From: Bill Wendling Date: Mon, 18 Aug 2014 05:18:35 +0000 (+0000) Subject: Merging r215609: X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8da00ef42a59574cae8a73bee5b1ed823f8364ba;p=clang Merging r215609: ------------------------------------------------------------------------ r215609 | majnemer | 2014-08-13 17:49:23 -0700 (Wed, 13 Aug 2014) | 3 lines 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/branches/release_35@215881 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;