summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplate.cpp
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2014-12-20 02:42:08 +0000
committerRichard Trieu <rtrieu@google.com>2014-12-20 02:42:08 +0000
commitd787e8dc9d74011f4d2fa70e5941aad3eeec0f53 (patch)
treea2da0cac72a43f442ba04ec94c645c9946b23401 /clang/lib/Sema/SemaTemplate.cpp
parent113dc64c67b4c56ab0a32835d148600c5fb544e0 (diff)
downloadbcm5719-llvm-d787e8dc9d74011f4d2fa70e5941aad3eeec0f53.tar.gz
bcm5719-llvm-d787e8dc9d74011f4d2fa70e5941aad3eeec0f53.zip
Fix for PR21758
When a non-type template argument expression needs a conversion to change it into the argument type, preserve that information by remaking the TemplateArgument with an expression that has those conversions. Also a small fix to template type diffing to handle the extra conversions in some cases. llvm-svn: 224667
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplate.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 67c36a5fb5e..20996492268 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -3433,6 +3433,13 @@ bool Sema::CheckTemplateArgument(NamedDecl *Param,
if (Res.isInvalid())
return true;
+ // If the resulting expression is new, then use it in place of the
+ // old expression in the template argument.
+ if (Res.get() != Arg.getArgument().getAsExpr()) {
+ TemplateArgument TA(Res.get());
+ Arg = TemplateArgumentLoc(TA, Res.get());
+ }
+
Converted.push_back(Result);
break;
}
OpenPOWER on IntegriCloud