https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103499
Bug ID: 103499 Summary: C++20 modules error: invalid use of non-static member function Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: oleg at smolsky dot net Target Milestone: --- There seems to be a bug when exporting a class hierarchy from a module. Here is the GCC11 output: /opt/gcc-11/bin/g++ -std=c++20 -fmodules-ts -c -o main.o main.cpp main.cpp: In function ‘int main()’: main.cpp:6:12: error: invalid use of non-static member function ‘virtual Derived@task::~Derived()’ 6 | delete p; $ cat task.cpp export module task; #include "b.h" #include "d.h" $ cat b.h #pragma once export struct Base { virtual ~Base() = default; void DoStuff(); }; $ cat d.h #include "b.h" export struct Derived : Base { ~Derived(); }; $ cat main.cpp import task; int main() { auto p = new Derived; p->DoStuff(); delete p; }