@@ -5150,7 +5150,10 @@ emit_associated_thunks (tree fn)
enabling you to output all the thunks with the function itself. */
if (DECL_VIRTUAL_P (fn)
/* Do not emit thunks for extern template instantiations. */
- && ! DECL_REALLY_EXTERN (fn))
+ && ! DECL_REALLY_EXTERN (fn)
+ /* Do not emit thunks for tentative decls, those will be processed
+ again at_eof if really needed. */
+ && (DECL_INTERFACE_KNOWN (fn) || !DECL_DEFER_OUTPUT (fn)))
{
tree thunk;
@@ -0,0 +1,19 @@
+// PR c++/117317
+// { dg-do compile { target c++20 } }
+
+struct C {
+ constexpr bool operator== (const C &b) const { return foo (); }
+ constexpr virtual bool foo () const = 0;
+};
+class A : public C {};
+class B : public C {};
+template <int>
+struct D : A, B
+{
+ constexpr bool operator== (const D &) const = default;
+ constexpr bool foo () const override { return true; }
+};
+struct E : D<1> {};
+constexpr E e;
+constexpr E f;
+static_assert (e == f, "");
@@ -0,0 +1,15 @@
+// PR c++/117317
+// { dg-do compile { target c++20 } }
+
+struct C {
+ constexpr virtual bool foo () const = 0;
+};
+struct A : public C {};
+struct B : public C {};
+template <int>
+struct D : A, B
+{
+ constexpr bool foo () const override { return true; }
+};
+constexpr D<0> d;
+static_assert (d.foo (), "");