On Wed, May 29, 2019 at 12:31:52PM -0400, Jason Merrill wrote: > On 5/24/19 4:21 AM, Jakub Jelinek wrote: > > The second patch fixes that by special casing void type MODIFY_EXPR, I > > believe if we have void type MODIFY_EXPR, then it can't be an lvalue. > > Any expression with void type is a prvalue, so let's not limit this to > MODIFY_EXPR.
So like this? So far no regressions in make check-c++-all, ok if it passes full bootstrap/regtest? The fact that cv void type expressions are prvalues has been clarified only recently in https://github.com/cplusplus/draft/commit/27d19661fbb0a5424f72330724d9809618efbb8b it seems, is it true that they have been prvalues already in C++11 and non-lvalues in C++98? 2019-05-29 Jakub Jelinek <ja...@redhat.com> PR c++/90598 * tree.c (lvalue_kind): Return clk_none for expressions with with VOID_TYPE_P. * g++.dg/cpp0x/pr90598.C: New test. --- gcc/cp/tree.c.jj 2019-05-20 23:33:13.819084157 +0200 +++ gcc/cp/tree.c 2019-05-29 18:44:35.619408978 +0200 @@ -83,6 +83,10 @@ lvalue_kind (const_tree ref) if (ref == current_class_ptr) return clk_none; + /* Expressions with cv void type are prvalues. */ + if (TREE_TYPE (ref) && VOID_TYPE_P (TREE_TYPE (ref))) + return clk_none; + switch (TREE_CODE (ref)) { case SAVE_EXPR: --- gcc/testsuite/g++.dg/cpp0x/pr90598.C.jj 2019-05-29 18:41:43.882194503 +0200 +++ gcc/testsuite/g++.dg/cpp0x/pr90598.C 2019-05-29 18:41:43.882194503 +0200 @@ -0,0 +1,8 @@ +// PR c++/90598 +// { dg-do compile { target c++11 } } + +struct A {}; +using B = decltype(A ().~A ()); +template <typename T> struct C; +template <> struct C<void> {}; +C<B> t; Jakub