[PATCH] D78134: [Sema] Don't apply an lvalue-to-rvalue conversion to a discarded-value expression if it has an array type

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 14 12:24:42 PDT 2020


rjmccall added a comment.

C++ says:

[expr.context]p2:

> In some contexts, an expression only appears for its side effects. Such an expression is called a discarded-value expression. The array-to-pointer (7.3.2) and function-to-pointer (7.3.3) standard conversions are not applied. The lvalue-to-rvalue conversion (7.3.1) is applied if and only if the expression is a glvalue of volatile-qualified type and it is one of the following:
> 
> - (list of special forms)

[conv.lval]p1:

> A glvalue of a non-function, non-array type T can be converted to a prvalue.

So I think the right fix is probably to make sure that `Sema::DefaultLvalueConversion` ignores gl-values of array type.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78134/new/

https://reviews.llvm.org/D78134





More information about the cfe-commits mailing list