-
Notifications
You must be signed in to change notification settings - Fork 215
Open
Description
Some value category parsing logic is different from cppreference.
For example, assignment operators and comma operators are prvalue.
The following expressions are non-lvalue object expressions:
- integer, character, and floating constants
- all operators not specified to return lvalues, including
- any function call expression
- any cast expression (note that compound literals, which look similar, are lvalues)
- member access operator (dot) applied to a non-lvalue structure/union, f().x, (x, s1).a, (s1 = s2).m
- results of all arithmetic, relational, logical, and bitwise operators
- results of increment and decrement operators (note: pre-forms are lvalues in C++)
- results of assignment operators (note: also lvalues in C++)
- the conditional operator (note: is lvalue in C++ if both the second and third operands are lvalues of the same type)
- the comma operator (note: is lvalue in C++ if the second operand is)
- the address-of operator, even if neutralized by application to the result of unary * operator
But in cdt, they are lvalue or conditional lvalue.
Lines 274 to 290 in c63f988
public boolean isLValue() { | |
switch (getOperator()) { | |
case op_assign: | |
case op_binaryAndAssign: | |
case op_binaryOrAssign: | |
case op_binaryXorAssign: | |
case op_divideAssign: | |
case op_minusAssign: | |
case op_moduloAssign: | |
case op_multiplyAssign: | |
case op_plusAssign: | |
case op_shiftLeftAssign: | |
case op_shiftRightAssign: | |
return true; | |
} | |
return false; | |
} |
Lines 120 to 128 in c63f988
@Override | |
public boolean isLValue() { | |
for (int i = expressions.length - 1; i >= 0; i--) { | |
IASTExpression expr = expressions[i]; | |
if (expr != null) | |
return expr.isLValue(); | |
} | |
return false; | |
} |
Metadata
Metadata
Assignees
Labels
No labels