https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86305
Bug ID: 86305 Summary: g++ segfaults when compiling template member function that calls destructor Product: gcc Version: 8.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: zhonghao at pku dot org.cn Target Milestone: --- The code is as follow: template <typename T> struct C1 { ~C1() {} void foo1(); }; template<typename T> void C1<T>::foo1() { C1::~C1(); } void foo1() { C1<int> x; x.foo1(); } clang++ accepts the code, but g++ rejects it: code0.c.cpp: In instantiation of 'void C1<T>::foo1() [with T = int]': code0.c.cpp:16:9: required from here code0.c.cpp:11:9: error: no matching function for call to 'C1<int>::~C1()' C1::~C1(); ~~~~~~~^~ code0.c.cpp:5:2: note: candidate: 'C1<T>::~C1() [with T = int]' ~C1() {} ^ code0.c.cpp:5:2: note: candidate expects 1 argument, 0 provided A previous version of clang++ produces similar error messages:https://bugs.llvm.org/show_bug.cgi?id=30361 Please check whether it indicates a bug.