diff options
author | Richard Trieu <rtrieu@google.com> | 2018-10-24 02:07:41 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2018-10-24 02:07:41 +0000 |
commit | a451599f89b4c4bc36cbbbdae3b6acc94763830a (patch) | |
tree | 68d8a316de55ea485c311dd02634955d420157a9 /clang/lib/Sema | |
parent | ad11526c30b8f621957d077f4eaf96b68077ebaf (diff) | |
download | bcm5719-llvm-a451599f89b4c4bc36cbbbdae3b6acc94763830a.tar.gz bcm5719-llvm-a451599f89b4c4bc36cbbbdae3b6acc94763830a.zip |
[Sema] Fix -Wcomma in dependent context
When there is a dependent type inside a cast, the CastKind becomes CK_Dependent
instead of CK_ToVoid. This fix will check that there is a dependent cast,
the original type is dependent, and the target type is void to ignore the cast.
https://bugs.llvm.org/show_bug.cgi?id=39375
llvm-svn: 345111
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 2cee761da3c..98025ca27c6 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -11280,6 +11280,12 @@ static bool IgnoreCommaOperand(const Expr *E) { if (CE->getCastKind() == CK_ToVoid) { return true; } + + // static_cast<void> on a dependent type will not show up as CK_ToVoid. + if (CE->getCastKind() == CK_Dependent && E->getType()->isVoidType() && + CE->getSubExpr()->getType()->isDependentType()) { + return true; + } } return false; |