]> granicus.if.org Git - clang/commitdiff
Sema: Permit nullptr template args in MSVC compat mode
authorDavid Majnemer <david.majnemer@gmail.com>
Thu, 14 Aug 2014 00:49:23 +0000 (00:49 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Thu, 14 Aug 2014 00:49:23 +0000 (00:49 +0000)
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

lib/Sema/SemaTemplate.cpp
test/Parser/MicrosoftExtensions.cpp

index d81f651368816d90c85eca51ebde880d329fed43..63581a44dbe5b365004bec3a552bc8b5e6279f36 100644 (file)
@@ -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.
index a35d0695b08cd0233452586a61c213e675db4d88..0174ec2f292def7b8a86d7a8d4865b3cd98b8a1f 100644 (file)
@@ -118,7 +118,7 @@ typedef COM_CLASS_TEMPLATE_REF<struct_with_uuid, __uuidof(struct_with_uuid)> COM
 
 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;