https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86580
Bug ID: 86580 Summary: No warning for default arguments Product: gcc Version: 9.0 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: struct S { S(const S&, int); S(int); }; S::S(const S& = S(0), int = 0) {} g++ accepts without any warning messages. Instead, clang++ reports: code0.cpp:1:55: error: addition of default argument on redeclaration makes this constructor a default constructor struct S { S(const S&, int); S(int); }; S::S(const S& = S(0), int = 0) {} ^ ~~~~ code0.cpp:1:12: note: previous declaration is here struct S { S(const S&, int); S(int); }; S::S(const S& = S(0), int = 0) {} ^ 1 error generated.