aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2019-02-13 15:48:37 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2019-02-13 15:48:37 +0000
commit6174de7c40e6e4c70cbab2250ca77a26a9015c0b (patch)
tree838b1c00a49568f1bf793a8e4e40340d7aeb611e /gcc
parent0c63a8ee9168d4d3cb0e7b97b78e324f65e1a22a (diff)
downloadgcc-6174de7c40e6e4c70cbab2250ca77a26a9015c0b.zip
gcc-6174de7c40e6e4c70cbab2250ca77a26a9015c0b.tar.gz
gcc-6174de7c40e6e4c70cbab2250ca77a26a9015c0b.tar.bz2
C++ concepts: fix ICE with requires on dtors (PR c++/89036)
PR c++/89036 reports an ICE due to this assertion failing 1136 /* A class should never have more than one destructor. */ 1137 gcc_assert (!current_fns || via_using || !DECL_DESTRUCTOR_P (method)); on this template with a pair of dtors, with mutually exclusive "requires" clauses: template<typename T> struct Y { ~Y() requires(true) = default; ~Y() requires(false) {} }; Nathan introduced this assertion as part of: ca9219bf18c68a001d62ecb981bc9176b0feaf12 (aka r251340): 2017-08-24 Nathan Sidwell <nathan@acm.org> Conversion operators kept on single overload set which, amongst other changes to add_method had this: /* A class should never have more than one destructor. */ - if (current_fns && DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (method)) - return false; + gcc_assert (!current_fns || !DECL_DESTRUCTOR_P (method)); The following patch drops the assertion (I already had to generalize the assertion in r268041 to fix PR c++/88699). gcc/cp/ChangeLog: PR c++/89036 * class.c (add_method): Drop destructor assertion. gcc/testsuite/ChangeLog: PR c++/89036 * g++.dg/concepts/pr89036.C: New test. From-SVN: r268847
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/class.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/concepts/pr89036.C8
4 files changed, 18 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b423f7c..8533fa8 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2019-02-13 David Malcolm <dmalcolm@redhat.com>
+
+ PR c++/89036
+ * class.c (add_method): Drop destructor assertion.
+
2019-02-13 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/88986
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 48da081..f44acfd 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -1134,9 +1134,6 @@ add_method (tree type, tree method, bool via_using)
}
}
- /* A class should never have more than one destructor. */
- gcc_assert (!current_fns || via_using || !DECL_DESTRUCTOR_P (method));
-
current_fns = ovl_insert (method, current_fns, via_using);
if (!COMPLETE_TYPE_P (type) && !DECL_CONV_FN_P (method)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5f220cc..583b045 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-02-13 David Malcolm <dmalcolm@redhat.com>
+
+ PR c++/89036
+ * g++.dg/concepts/pr89036.C: New test.
+
2019-02-13 Tamar Christina <tamar.christina@arm.com>
PR target/88847
diff --git a/gcc/testsuite/g++.dg/concepts/pr89036.C b/gcc/testsuite/g++.dg/concepts/pr89036.C
new file mode 100644
index 0000000..f83ef8b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/concepts/pr89036.C
@@ -0,0 +1,8 @@
+// { dg-do compile { target c++11 } }
+// { dg-options "-fconcepts" }
+
+template<typename T>
+struct Y {
+ ~Y() requires(true) = default;
+ ~Y() requires(false) {}
+};