https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90102
Bug ID: 90102
Summary: Incorrect ambiguous overload with _GLIBCXX_DEBUG
Product: gcc
Version: 8.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: terra at gnome dot org
Target Milestone: ---
Created attachment 46170
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46170&action=edit
Preprocessed source code
The following code fails to compile with the debugging version of
containers. It's fine with the regular version.
Problem could be in either compiler or library. Assigning to c++ component for
now.
$ cat bbb.C
#include <vector>
class Foo {
public:
template<class Cont,
class Check = decltype(std::declval<Cont>().clear())>
operator Cont () const { return {}; }
};
std::vector<int> bar() {
return static_cast<std::vector<int>> (Foo());
}
$ /usr/local/products/gcc/8.2.0/bin/g++ -c bbb.C
[Nothing]
$ /usr/local/products/gcc/8.2.0/bin/g++ -D_GLIBCXX_DEBUG -c bbb.C
bbb.C: In function ‘std::__debug::vector<int> bar()’:
bbb.C:11:46: error: call of overloaded ‘vector(Foo)’ is ambiguous
return static_cast<std::vector<int>> (Foo());
^
In file included from
/usr/local/products/gcc/8.2.0/include/c++/8.2.0/vector:73,
from bbb.C:1:
/usr/local/products/gcc/8.2.0/include/c++/8.2.0/debug/vector:214:7: note:
candidate: ‘std::__debug::vector<_Tp, _Allocator>::vector(const _Base&) [with
_Tp = int; _Allocator = std::allocator<int>; std::__debug::vector<_Tp,
_Allocator>::_Base = std::__cxx1998::vector<int, std::allocator<int> >]’
vector(const _Base& __x)
^~~~~~
/usr/local/products/gcc/8.2.0/include/c++/8.2.0/debug/vector:196:7: note:
candidate: ‘std::__debug::vector<_Tp,
_Allocator>::vector(std::__debug::vector<_Tp, _Allocator>&&) [with _Tp = int;
_Allocator = std::allocator<int>]’
vector(vector&&) = default;
^~~~~~
/usr/local/products/gcc/8.2.0/include/c++/8.2.0/debug/vector:195:7: note:
candidate: ‘std::__debug::vector<_Tp, _Allocator>::vector(const
std::__debug::vector<_Tp, _Allocator>&) [with _Tp = int; _Allocator =
std::allocator<int>]’
vector(const vector&) = default;
^~~~~~
$ /usr/local/products/gcc/8.2.0/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/usr/local/products/gcc/8.2.0/bin/g++
COLLECT_LTO_WRAPPER=/usr/local/products/gcc/8.2.0/lib/gcc/x86_64-suse-linux/8.2.0/lto-wrapper
Target: x86_64-suse-linux
Configured with: ../../gcc-8.2.0/configure --enable-languages=c,c++,fortran
--enable-targets=x86_64-suse-linux,i686-suse-linux
--prefix=/usr/local/products/gcc/8.2.0 --with-gnu-as
--with-as=/usr/local/products/gcc/binutils-2.30/bin/as --with-gnu-ld
--with-ld=/usr/local/products/gcc/binutils-2.30/bin/ld.bfd
--enable-threads=posix --enable-shared --enable-__cxa_atexit
--enable-libstdcxx-allocator=pool x86_64-suse-linux
Thread model: posix
gcc version 8.2.0 (GCC)