https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105699

--- Comment #1 from Roy Jacobson <roi.jacobson1 at gmail dot com> ---
I want to suggest to also consider the case of overloading virtual functions
with non-virtual constrained functions. There's an open CWG issue about this
https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#2488 and the ABI
implications are very annoying. MSVC already forbid it.

It interacts very funnily with the special member functions paper (P0848).
Consider

template<int N>
struct A {
  A& operator=(A&&) requires true;
  virtual A& operator=(A&&);
};

template<int N>
struct B {
  B& operator=(B&&) requires false;
  virtual B& operator=(B&&);
};

template<int N>
struct C {
  ~C() requires true;
  virtual ~C();
};

template<int N>
struct D {
  ~D() requires false;
  virtual ~D();
};

template<int N>
struct E {
  void foo() requires false;
  virtual void foo();
};

template<int N>
struct F {
  void foo() requires false;
  virtual void foo();
};

Currently GCC will generate vtables for B,D, and for both E and F, which seems
wrong. (I think C shouldn't have a vtable but A probably should have one, if
I'm interpreting P0848 correctly).

Reply via email to