r215609 - Sema: Permit nullptr template args in MSVC compat mode
David Majnemer
david.majnemer at gmail.com
Wed Aug 13 17:49:24 PDT 2014
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;
More information about the cfe-commits
mailing list