https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97814
Bug ID: 97814 Summary: Copy constructor deletion not recognized in initialization list with -std=c++17 Product: gcc Version: 9.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: caparson at uwaterloo dot ca Target Milestone: --- Created attachment 49553 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49553&action=edit A short 12 line code snippet that when compiled reproduces the bug. When compiling the attached program with the command "gcc copyConstruct.cc -std=c++17" it does not produce the following error: copyConstruct.cc:11:20: error: use of deleted function ‘S::S(S&&)’ 11 | C() : lock(S(1)) {} | ^ copyConstruct.cc:4:5: note: declared here 4 | S( S && ) = delete; | ^ But it does with the command "gcc copyConstruct.cc -std=c++14". It seems to not recognize that the copy constructor is deleted when it is used in an initializer list.