Constant evaluator does not work on value-dependent or type-dependent
expressions.
Also fixed bugs uncovered by these assertions.
Paths
| Differential D61522
Added an assertion to constant evaluation enty points that prohibits dependent expressions ClosedPublic Authored by gribozavr on May 3 2019, 10:13 AM.
Details
Summary Constant evaluator does not work on value-dependent or type-dependent Also fixed bugs uncovered by these assertions.
Diff Detail
Event Timeline
Comment Actions
The bugs were detected by existing tests (those tests triggered the newly added assertions). gribozavr added inline comments.
Comment Actions The right thing to check in all of these cases should be only isValueDependent(). Every type-dependent expression should generally also be value-dependent (because the type is part of the value), but value-dependent exactly means "dependent in a way that prevents constant evaluation", so that's all that we should be checking. Comment Actions Addressed review comments:
Comment Actions
Done. PTAL.
gribozavr added inline comments.
rsmith added inline comments.
This revision is now accepted and ready to land.May 17 2019, 2:04 AM Closed by commit rL361050: Added an assertion to constant evaluation enty points that prohibits dependent… (authored by gribozavr). · Explain WhyMay 17 2019, 10:14 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 198042 clang/lib/AST/Expr.cpp
clang/lib/AST/ExprConstant.cpp
clang/lib/Sema/SemaChecking.cpp
clang/lib/Sema/SemaOpenMP.cpp
clang/lib/Sema/SemaOverload.cpp
|
I would suggest to modify the code of this function if we cannot get the value of the loops.
at the beginning of the function.