The following program fails to compile: ====================================================================== #include <tuple>
typedef std::tuple<int,int,int> Tuple; //typedef std::tuple<int,int> Tuple; Tuple A() { return Tuple(); } const Tuple B() { return Tuple(); } int main() { Tuple test(B()); //Tuple test(A()); } ====================================================================== The program compiles successfully when A() is used instead of B() to initialize the "test", or when a two-element tuple is used instead of a three-element tuple. This has happened with an svn snapshot of of g++-4.6 (Debians gcc-snapshot version 20100702-1) and with g++-4.4 (Debians g++-4.4 version 4.4.4-7). The compiler output is ====================================================================== export PATH=/usr/lib/gcc-snapshot/bin:$PATH && cd ~/src/dune2/dune-pdelab/dune/pdelab/test && g++ --version && g++ --std=c++0x -O0 -Wall tupletest.cc -o tupletest g++ (Debian 20100702-1) 4.6.0 20100702 (experimental) [trunk revision 161740] Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. In file included from tupletest.cc:1:0: /usr/lib/gcc-snapshot/lib/gcc/i486-linux-gnu/4.6.0/../../../../include/c++/4.6.0/tuple: In constructor 'std::_Head_base<_Idx, _Head, false>::_Head_base(_UHead&&) [with _UHead = const std::tuple<int, int, int>, unsigned int _Idx = 0u, _Head = int]': /usr/lib/gcc-snapshot/lib/gcc/i486-linux-gnu/4.6.0/../../../../include/c++/4.6.0/tuple:161:38: instantiated from 'std::_Tuple_impl<_Idx, _Head, _Tail ...>::_Tuple_impl(_UHead&&, _UTail&& ...) [with _UHead = const std::tuple<int, int, int>, _UTail = {}, unsigned int _Idx = 0u, _Head = int, _Tail = {int, int}]' /usr/lib/gcc-snapshot/lib/gcc/i486-linux-gnu/4.6.0/../../../../include/c++/4.6.0/tuple:239:54: instantiated from 'std::tuple< <template-parameter-1-1> >::tuple(_UElements&& ...) [with _UElements = {const std::tuple<int, int, int>}, _Elements = {int, int, int}]' tupletest.cc:11:17: instantiated from here /usr/lib/gcc-snapshot/lib/gcc/i486-linux-gnu/4.6.0/../../../../include/c++/4.6.0/tuple:94:42: error: cannot convert 'const std::tuple<int, int, int>' to 'int' in initialization ====================================================================== -- Summary: Can't copy-construct "tuple<int,int,int>" from "const tuple<int,int,int>" rvalue Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jorrit at jorrit dot de GCC build triplet: i486-linux-gnu GCC host triplet: i486-linux-gnu GCC target triplet: i486-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45228