https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110186
Bug ID: 110186 Summary: -Weffc++ does not recognize user defined constructor. Product: gcc Version: 13.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: amir.ahmed.ansari at outlook dot com Target Milestone: --- Created attachment 55292 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55292&action=edit Code to replicate the problem Compile the attached code with the following flags: -std=c++17 -Wall -pedantic -Wextra -Weffc++ -O3 -flto The following output is generated: <source>: In constructor 'C::C()': <source>:23:1: warning: 'C::a' should be initialized in the member initialization list [-Weffc++] 23 | C::C() = default; | ^ <source>: In constructor 'D::D()': <source>:28:5: warning: 'D::a' should be initialized in the member initialization list [-Weffc++] 28 | D() {} | ^ The compiler fails to consider B() = default; as a user defined default constructor and does not generate the warning to initialize a in the member initialization list.