summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplate.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-07-24 02:27:39 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-07-24 02:27:39 +0000
commit78bb36f15953e0b3c853c81f6d1b9ae008a18783 (patch)
tree682194e5213f49082211008a78a989cb92d49da2 /clang/lib/Sema/SemaTemplate.cpp
parent43b9a9b2c8f6aaac6a03cd71369b14c1a06a3d49 (diff)
downloadbcm5719-llvm-78bb36f15953e0b3c853c81f6d1b9ae008a18783.tar.gz
bcm5719-llvm-78bb36f15953e0b3c853c81f6d1b9ae008a18783.zip
Take the canonical type when forming a canonical template argument with
'nullptr' value. Fixes profiling of such template arguments to always give the same value. llvm-svn: 213834
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplate.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index d0f9b84d5d2..d81f6513688 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -4438,7 +4438,8 @@ CheckTemplateArgumentAddressOfObjectOrFunction(Sema &S,
switch (NPV) {
case NPV_NullPointer:
S.Diag(Arg->getExprLoc(), diag::warn_cxx98_compat_template_arg_null);
- Converted = TemplateArgument(ParamType, /*isNullPtr=*/true);
+ Converted = TemplateArgument(S.Context.getCanonicalType(ParamType),
+ /*isNullPtr=*/true);
return false;
case NPV_Error:
@@ -4633,7 +4634,8 @@ static bool CheckTemplateArgumentPointerToMember(Sema &S,
return true;
case NPV_NullPointer:
S.Diag(Arg->getExprLoc(), diag::warn_cxx98_compat_template_arg_null);
- Converted = TemplateArgument(ParamType, /*isNullPtr*/true);
+ Converted = TemplateArgument(S.Context.getCanonicalType(ParamType),
+ /*isNullPtr*/true);
if (S.Context.getTargetInfo().getCXXABI().isMicrosoft())
S.RequireCompleteType(Arg->getExprLoc(), ParamType, 0);
return false;
@@ -5089,7 +5091,8 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
case NPV_NullPointer:
Diag(Arg->getExprLoc(), diag::warn_cxx98_compat_template_arg_null);
- Converted = TemplateArgument(ParamType, /*isNullPtr*/true);
+ Converted = TemplateArgument(Context.getCanonicalType(ParamType),
+ /*isNullPtr*/true);
return Arg;
}
}
OpenPOWER on IntegriCloud