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

2020-05-13 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG50a81ea2bce3: Dont apply lvalue-to-rvalue conversion in DefaultLValueConversion to theā€¦ (authored by ahatanak). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

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

2020-05-13 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 263792. ahatanak marked an inline comment as done. ahatanak added a comment. Check function types in `DefaultLvalueConversion`. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D78134/new/

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

2020-05-11 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision. rjmccall added a comment. Alright, let's go with this. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D78134/new/ https://reviews.llvm.org/D78134 ___ cfe-commits mailing

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

2020-05-11 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith accepted this revision. rsmith added inline comments. This revision is now accepted and ready to land. Comment at: clang/lib/Sema/SemaExpr.cpp:601-603 // C++ [conv.lval]p1: // A glvalue of a non-function, non-array type T can be // converted to a prvalue.

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

2020-05-11 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 263309. ahatanak added a comment. Rebase and ping. I audited the calls to `DefaultLvalueConversion`. As far as I can tell, either an array type is never passed to the function call or there are checks that reject array types after the function is called,

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

2020-04-21 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 259081. ahatanak added a comment. Make Sema::DefaultLvalueConversion ignore 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 Files:

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

2020-04-15 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment. In D78134#1985467 , @ahatanak wrote: > In D78134#1982291 , @rsmith wrote: > > > So far, the direction the wind is blowing is that attempting to perform an > > lvalue-to-rvalue conversion on

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

2020-04-15 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. In D78134#1982291 , @rsmith wrote: > In D78134#1981866 , @rsmith wrote: > > > I'm going to take this to CWG. > > > So far, the direction the wind is blowing is that attempting to perform

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

2020-04-14 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment. In D78134#1982291 , @rsmith wrote: > In D78134#1981866 , @rsmith wrote: > > > I'm going to take this to CWG. > > > So far, the direction the wind is blowing is that attempting to perform

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

2020-04-14 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment. In D78134#1981866 , @rsmith wrote: > I'm going to take this to CWG. So far, the direction the wind is blowing is that attempting to perform an lvalue-to-rvalue conversion on an array should be a no-op. (That's weirdly different

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

2020-04-14 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment. It seems to me that there's as bug in the C++ specification here. The rules for discarded-value expressions say the lvalue-to-rvalue conversion is applied, whereas the rules for lvalue-to-rvalue conversions say one cannot be applied in this case. It's hard to guess what

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

2020-04-14 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment. That doesn't seem to be how we use it in practice; I'd just change the comment. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D78134/new/ https://reviews.llvm.org/D78134 ___

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

2020-04-14 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment. My first patch just did that and it seems to work. But the comment for `DefaultLvalueConversion` says "This is DefaultFunctionArrayLvalueConversion, except that it assumes the operand isn't of function or array type". It doesn't even have assertions to check that

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

2020-04-14 Thread John McCall via Phabricator via cfe-commits
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

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

2020-04-14 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak created this revision. ahatanak added reviewers: efriedma, rsmith, rjmccall. ahatanak added a project: clang. Herald added subscribers: ributzka, dexonsmith, jkorous. This fixes a bug which causes clang to emit incorrect IR for the following code in C++: int foo(void) { unsigned