From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23250 invoked by alias); 7 Aug 2010 20:03:57 -0000 Received: (qmail 23212 invoked by uid 48); 7 Aug 2010 20:03:45 -0000 Date: Sat, 07 Aug 2010 20:03:00 -0000 Subject: [Bug libstdc++/45228] New: Can't copy-construct "tuple" from "const tuple" rvalue X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "jorrit at jorrit dot de" 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: 2010-08/txt/msg00557.txt.bz2 The following program fails to compile: ====================================================================== #include typedef std::tuple Tuple; //typedef std::tuple 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, 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, _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< >::tuple(_UElements&& ...) [with _UElements = {const std::tuple}, _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' to 'int' in initialization ====================================================================== -- Summary: Can't copy-construct "tuple" from "const tuple" 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