From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24290 invoked by alias); 3 May 2013 03:03:35 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 24258 invoked by uid 48); 3 May 2013 03:03:28 -0000 From: "f.heckenbach@fh-soft.de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/57153] New: [C++11] tries to use copy constructor for in-class initialized member in default constructor of template struct Date: Fri, 03 May 2013 03:03:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: f.heckenbach@fh-soft.de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 X-SW-Source: 2013-05/txt/msg00143.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57153 Bug #: 57153 Summary: [C++11] tries to use copy constructor for in-class initialized member in default constructor of template struct Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: f.heckenbach@fh-soft.de Created attachment 30014 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30014 Test case The included test case produces the following error: % g++-4.7 -std=c++11 test.cpp test.cpp: In constructor 'constexpr B<0>::B()': test.cpp:8:8: error: use of deleted function 'A::A(const A&)' test.cpp:4:3: error: declared here test.cpp: In function 'int main()': test.cpp:17:9: note: synthesized method 'constexpr B<0>::B()' first required here I don't think a copy constructor of the member should be needed for the default constructor of the containing struct. The error disappears when I declare the latter explicitly, but not when I declare it as "= default". Is also disappears if struct B is not a template. I don't see why this should make a difference.