[PATCH] D55413: [ExprConstant] Handle compound assignment when LHS has integral type and RHS has floating point type
Bruno Ricci via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 11 07:54:26 PST 2018
riccibruno added inline comments.
================
Comment at: clang/lib/AST/ExprConstant.cpp:3427
- if (!SubobjType->isIntegerType() || !RHS.isInt()) {
+ if (!SubobjType->isIntegerType() || !RHS.isInt() && !RHS.isFloat()) {
// We don't support compound assignment on integer-cast-to-pointer
----------------
Parentheses ? It is always nicer to be able to read this
without having to remember whether `||` has a higher precedence
than `&&`.
================
Comment at: clang/test/SemaCXX/constant-expression-cxx1y.cpp:343
if (a != 7) return false;
- a *= 3;
if (a != 21) return false;
----------------
Why remove `a *= 3` instead of just adding `a *= 3.1`.
================
Comment at: clang/test/SemaCXX/constant-expression-cxx1y.cpp:345
if (a != 21) return false;
- if (&(a /= 10) != &a) return false;
if (a != 2) return false;
----------------
same
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55413/new/
https://reviews.llvm.org/D55413
More information about the cfe-commits
mailing list