re PR c++/90598 (Return type of explicit destructor call wrong)
authorJakub Jelinek <jakub@redhat.com>
Wed, 29 May 2019 21:33:18 +0000 (23:33 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 29 May 2019 21:33:18 +0000 (23:33 +0200)
PR c++/90598
* tree.c (lvalue_kind): Return clk_none for expressions with
with VOID_TYPE_P.

* g++.dg/cpp0x/pr90598.C: New test.

From-SVN: r271752

gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/pr90598.C [new file with mode: 0644]

index ee7eab080cbc87d2211c58bd3716a29750c5660f..647dd7d5ef6ec001e714c28cc3dd33b19b122a1c 100644 (file)
@@ -1,3 +1,9 @@
+2019-05-29  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/90598
+       * tree.c (lvalue_kind): Return clk_none for expressions with
+       with VOID_TYPE_P.
+
 2019-05-29  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/89875
index 78139329476d78d5bd722cf9c9c88e4e171858ea..cd021b7f594e9b258d7cc9c4e4dffb969712e62c 100644 (file)
@@ -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:
index a0e8b7bc492b6590ad556476f6d10ba8672ed65a..b8fdc2fae1cd6d6ddf0926c3408ef95c813baf32 100644 (file)
@@ -1,3 +1,8 @@
+2019-05-29  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/90598
+       * g++.dg/cpp0x/pr90598.C: New test.
+
 2019-05-29  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/90539
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr90598.C b/gcc/testsuite/g++.dg/cpp0x/pr90598.C
new file mode 100644 (file)
index 0000000..2e77444
--- /dev/null
@@ -0,0 +1,16 @@
+// 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;
+// 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;