summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp
index 3a4e75bcda8..a4b83ada98d 100644
--- a/clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp
@@ -138,7 +138,8 @@ void StringConstructorCheck::check(const MatchFinder::MatchResult &Result) {
}
} else if (const auto *Ptr = Result.Nodes.getNodeAs<Expr>("from-ptr")) {
Expr::EvalResult ConstPtr;
- if (Ptr->EvaluateAsRValue(ConstPtr, Ctx) &&
+ if (!Ptr->isInstantiationDependent() &&
+ Ptr->EvaluateAsRValue(ConstPtr, Ctx) &&
((ConstPtr.Val.isInt() && ConstPtr.Val.getInt().isNullValue()) ||
(ConstPtr.Val.isLValue() && ConstPtr.Val.isNullPointer()))) {
diag(Loc, "constructing string from nullptr is undefined behaviour");
OpenPOWER on IntegriCloud