From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30583 invoked by alias); 15 Jan 2013 18:44:28 -0000 Received: (qmail 29043 invoked by uid 48); 15 Jan 2013 18:44:11 -0000 From: "jnapoli at alum dot mit.edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/55993] tuple_cat not a constant expression for result size >= 3 Date: Tue, 15 Jan 2013 18:44:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jnapoli at alum dot mit.edu X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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: 2013-01/txt/msg01409.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55993 --- Comment #3 from Joshua Napoli 2013-01-15 18:44:10 UTC --- The problem has to do with a completely empty struct being used twice consecutively in the tuple type list. std::tuple inherits from A (by inheriting _Head_base which inherits A). Maybe there is a problem with confusing the inherited types when struct A is empty and the base A might not have a separate address from the top-level tuple. It compiles OK when I add a member variable: struct A { constexpr A() : x(0) {} int x; }; constexpr std::tuple t; constexpr auto a = decltype(t)::_M_head(t); But fails without it: struct A { constexpr A() /*: x(0)*/ {} /*int x;*/ }; constexpr std::tuple t; constexpr auto a = decltype(t)::_M_head(t); It compiles OK when I use two different classes struct A { constexpr A() {} }; struct B { constexpr B() {} }; constexpr std::tuple t; constexpr auto a = decltype(t)::_M_head(t); If fails to build with two As and a B: struct A { constexpr A() {} }; struct B { constexpr B() {} }; constexpr std::tuple t; constexpr auto a = decltype(t)::_M_head(t); (Note that std::get<0>( std::tuple<...> ) returns std::tuple<...>::_M_head(t).)