diff options
author | Richard Trieu <rtrieu@google.com> | 2016-08-05 21:02:34 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2016-08-05 21:02:34 +0000 |
commit | 71d74d4b256709ad9ad3ae6927486e46dfc280c3 (patch) | |
tree | a239679552dea5b7d5950c256b158d26f7d1d81b /clang/lib/Sema/SemaChecking.cpp | |
parent | f68a6a720cbea1863afd99b49e04b42e34787f97 (diff) | |
download | llvm-71d74d4b256709ad9ad3ae6927486e46dfc280c3.zip llvm-71d74d4b256709ad9ad3ae6927486e46dfc280c3.tar.gz llvm-71d74d4b256709ad9ad3ae6927486e46dfc280c3.tar.bz2 |
Fix false positive in -Wunsequenced and templates.
For builtin logical operators, there is a well-defined ordering of argument
evaluation. For overloaded operator of the same type, there is no argument
evaluation order, similar to other function calls. When both are present,
uninstantiated templates with an operator&& is treated as an unresolved
function call. Unresolved function calls are treated as normal function calls,
and may result in false positives when the builtin logical operator is used.
Have the unsequenced checker ignore dependent expressions to avoid this
false positive. The check also happens in template instantiations to catch
when the overloaded operator is used.
llvm-svn: 277866
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 12f3923..2ca3d12 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -9427,7 +9427,8 @@ void Sema::CheckUnsequencedOperations(Expr *E) { void Sema::CheckCompletedExpr(Expr *E, SourceLocation CheckLoc, bool IsConstexpr) { CheckImplicitConversions(E, CheckLoc); - CheckUnsequencedOperations(E); + if (!E->isInstantiationDependent()) + CheckUnsequencedOperations(E); if (!IsConstexpr && !E->isValueDependent()) CheckForIntOverflow(E); } |