[clang] Reapply "[Clang][Sema] Earlier type checking for builtin unary operators (#90500)" (PR #92283)
Krystian Stasiowski via cfe-commits
cfe-commits at lists.llvm.org
Thu May 16 09:32:46 PDT 2024
sdkrystian wrote:
@Caslyn [[expr.prim.this] p3](http://eel.is/c++draft/expr.prim.this#3) states:
> [...] the expression this is a prvalue of type “pointer to _cv-qualifier-seq_ `X`” wherever `X` is the current class [...]
And [[over.match.oper] p1](http://eel.is/c++draft/over.match.oper#1) states:
> If no operand of an operator in an expression has a type that is a class or an enumeration, the operator is assumed to be a built-in operator and interpreted according to [[expr.compound]](http://eel.is/c++draft/expr.compound).
Since the type of `this` is a pointer, `++this` uses the built-in prefix increment operator. The operand of the built-in prefix increment operator must be an lvalue (and `this` is a prvalue).
https://github.com/llvm/llvm-project/pull/92283
More information about the cfe-commits
mailing list