From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25534 invoked by alias); 18 Apr 2012 22:09:29 -0000 Received: (qmail 25524 invoked by uid 22791); 18 Apr 2012 22:09:27 -0000 X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 18 Apr 2012 22:08:40 +0000 From: "eric.niebler at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/53036] New: [c++11] trivial class fails std::is_trivial test Date: Wed, 18 Apr 2012 22:09: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: eric.niebler at gmail dot com 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 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 X-SW-Source: 2012-04/txt/msg01573.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53036 Bug #: 53036 Summary: [c++11] trivial class fails std::is_trivial test Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: eric.niebler@gmail.com In my understanding of the new C++ standard, the following code should compile. It does not. struct D { D() = default; D(D const &) = default; template constexpr D(U ...u) {} }; static_assert(std::is_trivial::value, "here"); The problem is the variadic constexpr constructor. I'm guessing here that the problem is that it could also be used as a default constructor, making the type non-trivial. However, I have explicitly defaulted the default constructor, so the variadic constructr should never be considered for 0 arguments. I base the above supposition on the fact that if I add a dummy argument to the variadic as below, it works: struct D { D() = default; D(D const &) = default; template constexpr D(int, U ...u) // dummy arg, not default c'tor, ok. {} }; static_assert(std::is_trivial::value, "here");