Following code does not compile with gcc-snapshot(2013-10-21) : #include <tuple> using namespace std; struct t1{ constexpr t1(){} }; struct t2{ constexpr t2(){} }; int main() { constexpr t1 T1; constexpr t2 T2; constexpr tuple<t1,t2> Tup1(T1,T2); constexpr tuple<t1,t1> Tup2(T1,T1); constexpr auto a=get<0>(Tup1 ); //works fine constexpr auto b=get<0>(Tup2 ); // error: //'(const std::_Head_base<0ul, t1, true>*)(& Tup2)' //is not a constant expression constexpr auto b=get<0>(Tup2 ); return 0; }
This is a regression and I don't think we changed anything in the library?!? Looks like a C++ regression then, and we would need a reduced testcase.
Sorry, in fact this isn't a regression. Still the issue seems serious in terms of impact on <tuple> use. I also note that with the same <tuple> implementation, clang++ accepts the testcases, thus seems definitely a front-end issue.
I can't reproduce this bug with the current trunk.
Indeed. Let's play safe and add a testcase before closing the bug as fixed for 5+.
Author: paolo Date: Wed Nov 25 10:00:02 2015 New Revision: 230860 URL: https://gcc.gnu.org/viewcvs?rev=230860&root=gcc&view=rev Log: 2015-11-25 Paolo Carlini <paolo.carlini@oracle.com> PR c++/58910 * g++.dg/cpp0x/constexpr-tuple2.C: New. Added: trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-tuple2.C Modified: trunk/gcc/testsuite/ChangeLog
Done.