diff options
author | Bill Wendling <isanbard@gmail.com> | 2014-08-04 18:38:09 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2014-08-04 18:38:09 +0000 |
commit | 4c14469fb9fd26452210c41868dd00adb3265421 (patch) | |
tree | 1867f0a311d329b9ceb6e644e378adca14abd7c5 /lib/Sema/SemaTemplate.cpp | |
parent | 266fa309e73bb4649c3d53e15179fcc9d4c59e42 (diff) |
Merging r213834:
------------------------------------------------------------------------
r213834 | rsmith | 2014-07-23 19:27:39 -0700 (Wed, 23 Jul 2014) | 4 lines
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.
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_35@214751 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplate.cpp')
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index d0f9b84d5d..d81f651368 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/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; } } |