https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105320
Bug ID: 105320 Summary: Use of shared_ptr within a type exported from a module results in spurious compiler error Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: john at johnmaddock dot co.uk Target Milestone: --- Reduced test case: module.cpp: module; #include <memory> export module test_support; export template <class T> struct pimpl { private: std::shared_ptr<T> data; public: pimpl(const T& x) : data(new T(x)) {} pimpl() = default; }; test_module.cpp: import test_support; int main() { pimpl<int> p1, p2(3); } Compile with: g++ -std=gnu++20 -fmodules-ts module.cpp test_module.cpp Results in: D:/compilers/msys64/mingw64/include/c++/11.2.0/bits/shared_ptr_base.h:1369: confused by earlier errors, bailing out Note that there were no earlier errors ! ;)