This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/33930] New: [4.3 regression] ambiguous overload in std::stack::push() when using --std=cxx0x
- From: "a dot chavasse at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 28 Oct 2007 15:18:58 -0000
- Subject: [Bug c++/33930] New: [4.3 regression] ambiguous overload in std::stack::push() when using --std=cxx0x
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
g++43 -v:
Using built-in specs.Target: x86_64-unknown-linux-gnuConfigured with:
../gcc/configure --program-suffix=43 --disable-multilib
--enable-languages=c,c++Thread model: posixgcc version 4.3.0 20071028
(experimental) (GCC)
(it was built from svn trunk, revision 129693)
Not sure whether it really counts as a regression since it happens only in
c++0x experimental mode, but it does prevent code that normally compiles to
fail to do so when enabling c++0x mode, like the following snippet:
==========================
#include <stack>
void foo()
{
std::stack< const int* > somestack;
int* someptr = 0;
somestack.push( someptr );
}
==========================
It fails to build with --std=cxx0x with the following error:
rvalref-overload-stdstack.cpp: In function 'void foo()':
rvalref-overload-stdstack.cpp:7: error: call of overloaded 'push(int*&)' is
ambiguous
/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/stl_stack.h:188:
note: candidates are: void std::stack<_Tp, _Sequence>::push(const typename
_Sequence::value_type&) [with
_Tp = const int*, _Sequence = std::deque<const int*, std::allocator<const int*>
>]
/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/stl_stack.h:193:
note: void std::stack<_Tp, _Sequence>::push(typename
_Sequence::value_type&&) [with _Tp =
const int*, _Sequence = std::deque<const int*, std::allocator<const int*> >]
Here is a c++0x only test case not involving any headers that triggers the same
error with similar overloads:
==========================
typedef const int* type;
void foo( const type& ggg ) {}
void foo( type&& ggg ) {}
void bar( int* someptr )
{
foo( someptr );
}
==========================
--
Summary: [4.3 regression] ambiguous overload in
std::stack::push() when using --std=cxx0x
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: a dot chavasse at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33930