Message ID | 20190524082152.GO19695@tucnak |
---|---|
State | New |
Headers | show |
Series | [C++] Fix decltype on a trivial dtor with -flifetime-dse (PR c++/90598) | expand |
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. Jason
--- gcc/cp/call.c.jj 2019-05-23 12:57:16.658493722 +0200 +++ gcc/cp/call.c 2019-05-23 18:37:09.570874611 +0200 @@ -7995,8 +7995,8 @@ build_trivial_dtor_call (tree instance) /* A trivial destructor should still clobber the object. */ tree clobber = build_clobber (TREE_TYPE (instance)); - return build2 (MODIFY_EXPR, void_type_node, - instance, clobber); + return build1 (NOP_EXPR, void_type_node, + build2 (MODIFY_EXPR, void_type_node, instance, clobber)); } /* Subroutine of the various build_*_call functions. Overload resolution --- gcc/testsuite/g++.dg/cpp0x/pr90598.C.jj 2019-05-23 18:39:37.034464509 +0200 +++ gcc/testsuite/g++.dg/cpp0x/pr90598.C 2019-05-23 18:39:05.471980348 +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;