[gcc/devel/omp/gcc-9] backport: re PR c++/90598 (Return type of explicit destructor call wrong)

Tobias Burnus burnus@gcc.gnu.org
Thu Mar 5 13:57:00 GMT 2020


https://gcc.gnu.org/g:804b831eab29730059cf8221f9c802c35722e2f0

commit 804b831eab29730059cf8221f9c802c35722e2f0
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Jun 5 14:21:27 2019 +0200

    backport: re PR c++/90598 (Return type of explicit destructor call wrong)
    
    	Backported from mainline
    	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.
    
    	* g++.dg/cpp0x/pr90598.C: New test.
    
    	2019-05-02  Jonathan Wakely  <jwakely@redhat.com>
    
    	* testsuite/experimental/propagate_const/requirements2.cc: Adjust
    	dg-error.
    
    From-SVN: r271959

Diff:
---
 gcc/cp/ChangeLog                                              |  9 +++++++++
 gcc/cp/tree.c                                                 |  4 ++++
 gcc/testsuite/ChangeLog                                       |  8 ++++++++
 gcc/testsuite/g++.dg/cpp0x/pr90598.C                          |  8 ++++++++
 libstdc++-v3/ChangeLog                                        | 11 +++++++++++
 .../testsuite/experimental/propagate_const/requirements2.cc   |  9 ++++-----
 6 files changed, 44 insertions(+), 5 deletions(-)

diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a0235a7..ff5722cd 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,12 @@
+2019-06-05  Jakub Jelinek  <jakub@redhat.com>
+
+	Backported from mainline
+	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-28  Marek Polacek  <polacek@redhat.com>
 
 	Backported from mainline
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 718eed3..1339e9f 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -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:
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3f6a8ae..2317d65 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2019-06-05  Jakub Jelinek  <jakub@redhat.com>
+
+	Backported from mainline
+	2019-05-29  Jakub Jelinek  <jakub@redhat.com>
+
+	PR c++/90598
+	* g++.dg/cpp0x/pr90598.C: New test.
+
 2019-05-30  Iain Sandoe  <iain@sandoe.co.uk>
 
 	Backport from mainline.
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr90598.C b/gcc/testsuite/g++.dg/cpp0x/pr90598.C
new file mode 100644
index 0000000..0ee3fb1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr90598.C
@@ -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;
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 0bc01f8..8d3a5c5 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,14 @@
+2019-06-05  Jakub Jelinek  <jakub@redhat.com>
+
+	Backported from mainline
+	2019-05-29  Jakub Jelinek  <jakub@redhat.com>
+
+	PR c++/90598
+	2019-05-02  Jonathan Wakely  <jwakely@redhat.com>
+
+	* testsuite/experimental/propagate_const/requirements2.cc: Adjust
+	dg-error.
+
 2019-06-03  Jonathan Wakely  <jwakely@redhat.com>
 
 	PR libstdc++/90700
diff --git a/libstdc++-v3/testsuite/experimental/propagate_const/requirements2.cc b/libstdc++-v3/testsuite/experimental/propagate_const/requirements2.cc
index 29b63ea..11d6bfd 100644
--- a/libstdc++-v3/testsuite/experimental/propagate_const/requirements2.cc
+++ b/libstdc++-v3/testsuite/experimental/propagate_const/requirements2.cc
@@ -21,9 +21,8 @@
 
 using std::experimental::propagate_const;
 
-// { dg-error "requires a class or a pointer to an object type" "" { target *-*-* } 107 }
-// { dg-error "not a pointer-to-object type" "" { target *-*-* } 66 }
-// { dg-error "forming pointer to reference type" "" { target *-*-* } 187 }
-// { dg-error "forming pointer to reference type" "" { target *-*-* } 213 }
-
 propagate_const<void*> test1;
+
+// { dg-error "requires a class or a pointer to an object type" "" { target *-*-* } 0 }
+// { dg-prune-output "forming pointer to reference type" }
+// { dg-prune-output "not a pointer-to-object type" }



More information about the Gcc-cvs mailing list