Commit b9e03679 by David Malcolm Committed by David Malcolm

C++: Fix ICE when adding overloaded operator via using_decl (PR c++/88699)

PR c++/88699 reports an ICE within this assertion in add_method:

  gcc_assert (!current_fns || !DECL_DESTRUCTOR_P (method));

when adding an overloaded operator to a class via a using_decl, due to
DECL_DESTRUCTOR_P requiring a FUNCTION_DECL, but "method" being a
USING_DECL.

This patch weakens the assertion to avoid testing DECL_DESTRUCTOR_P
for the case where "via_using" is true, fixing the ICE.

gcc/cp/ChangeLog:
	PR c++/88699
	* class.c (add_method): Don't use DECL_DESTRUCTOR_P on
	USING_DECLs.

gcc/testsuite/ChangeLog:
	PR c++/88699
	* g++.dg/template/pr88699.C: New test.

From-SVN: r268041
parent 213694e5
2019-01-17 David Malcolm <dmalcolm@redhat.com>
PR c++/88699
* class.c (add_method): Don't use DECL_DESTRUCTOR_P on
USING_DECLs.
2019-01-17 Nathan Sidwell <nathan@acm.org>
PR c++/86610
......
......@@ -1134,7 +1134,7 @@ add_method (tree type, tree method, bool via_using)
}
/* A class should never have more than one destructor. */
gcc_assert (!current_fns || !DECL_DESTRUCTOR_P (method));
gcc_assert (!current_fns || via_using || !DECL_DESTRUCTOR_P (method));
current_fns = ovl_insert (method, current_fns, via_using);
......
2019-01-17 David Malcolm <dmalcolm@redhat.com>
PR c++/88699
* g++.dg/template/pr88699.C: New test.
2019-01-17 Martin Sebor <msebor@redhat.com>
PR tree-optimization/88800
......
// { dg-do compile }
template <typename>
struct A {
void operator= (int);
template <int> class B;
};
template <typename C>
template <int>
struct A<C>::B : A {
using A::operator=;
void operator= (B);
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment