OS version: Red Hat Enterprise Linux AS release 4 (Nahant Update 5) gcc version: g++ (GCC) 4.1.2 gcc command: gcc -c xx.cpp
Source file: ---------------------------------------------- #include <map> #include <set> class test { public: test() { } int** operator&() { return (int**)0; } operator int*() const { return (int*)0; } }; void foo() { test s; std::map< unsigned int, std::set<test> > m; m[0].insert( s ); } ---------------------------------------------- Compiler output: /usr/local/gnu/gcc/4.1.2/bin/g++ -v -save-temps -c xx.cpp Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../gcc-4.1.2/configure --prefix=/usr/local/gnu/gcc/4.1.2 --enable-languages=c,c++ Thread model: posix gcc version 4.1.2 /usr/local/gnu/gcc/4.1.2/libexec/gcc/i686-pc-linux-gnu/4.1.2/cc1plus -E -quiet -v -D_GNU_SOURCE xx.cpp -mtune=pentiumpro -fpch-preprocess -o xx.ii ignoring nonexistent directory "/usr/local/gnu/gcc/4.1.2/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../i686-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/local/gnu/gcc/4.1.2/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../include/c++/4.1.2 /usr/local/gnu/gcc/4.1.2/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../include/c++/4.1.2/i686-pc-linux-gnu /usr/local/gnu/gcc/4.1.2/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../include/c++/4.1.2/backward /usr/local/include /usr/local/gnu/gcc/4.1.2/include /usr/local/gnu/gcc/4.1.2/lib/gcc/i686-pc-linux-gnu/4.1.2/include /usr/include End of search list. /usr/local/gnu/gcc/4.1.2/libexec/gcc/i686-pc-linux-gnu/4.1.2/cc1plus -fpreprocessed xx.ii -quiet -dumpbase xx.cpp -mtune=pentiumpro -auxbase xx -version -o xx.s GNU C++ version 4.1.2 (i686-pc-linux-gnu) compiled by GNU C version 4.1.2. GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129323 Compiler executable checksum: edf0d2731cb64fda3dd46c0e3997ac20 /usr/local/gnu/gcc/4.1.2/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h: In member function 'void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::destroy_node(std::_Rb_tree_node<_Val>*) [with _Key = test, _Val = test, _KeyOfValue = std::_Identity<test>, _Compare = std::less<test>, _Alloc = std::allocator<test>]': /usr/local/gnu/gcc/4.1.2/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h:1266: instantiated from 'void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_erase(std::_Rb_tree_node<_Val>*) [with _Key = test, _Val = test, _KeyOfValue = std::_Identity<test>, _Compare = std::less<test>, _Alloc = std::allocator<test>]' /usr/local/gnu/gcc/4.1.2/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h:578: instantiated from 'std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::~_Rb_tree() [with _Key = test, _Val = test, _KeyOfValue = std::_Identity<test>, _Compare = std::less<test>, _Alloc = std::allocator<test>]' /usr/local/gnu/gcc/4.1.2/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_set.h:108: instantiated from '_Tp& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Key&) [with _Key = unsigned int, _Tp = std::set<test, std::less<test>, std::allocator<test> >, _Compare = std::less<unsigned int>, _Alloc = std::allocator<std::pair<const unsigned int, std::set<test, std::less<test>, std::allocator<test> > > >]' xx.cpp:17: instantiated from here /usr/local/gnu/gcc/4.1.2/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h:391: error: no matching function for call to 'std::allocator<test>::destroy(int**)' /usr/local/gnu/gcc/4.1.2/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h:107: note: candidates are: void __gnu_cxx::new_allocator<_Tp>::destroy(_Tp*) [with _Tp = test] /usr/local/gnu/gcc/4.1.2/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h: In member function 'std::_Rb_tree_node<_Val>* std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_create_node(const _Val&) [with _Key = test, _Val = test, _KeyOfValue = std::_Identity<test>, _Compare = std::less<test>, _Alloc = std::allocator<test>]': /usr/local/gnu/gcc/4.1.2/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h:819: instantiated from 'typename std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, const _Val&) [with _Key = test, _Val = test, _KeyOfValue = std::_Identity<test>, _Compare = std::less<test>, _Alloc = std::allocator<test>]' /usr/local/gnu/gcc/4.1.2/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h:927: instantiated from 'std::pair<typename std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::insert_unique(const _Val&) [with _Key = test, _Val = test, _KeyOfValue = std::_Identity<test>, _Compare = std::less<test>, _Alloc = std::allocator<test>]' /usr/local/gnu/gcc/4.1.2/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_set.h:321: instantiated from 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, typename _Alloc::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const _Key&) [with _Key = test, _Compare = std::less<test>, _Alloc = std::allocator<test>]' xx.cpp:17: instantiated from here /usr/local/gnu/gcc/4.1.2/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h:369: error: no matching function for call to 'std::allocator<test>::construct(int**, const test&)' /usr/local/gnu/gcc/4.1.2/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../include/c++/4.1.2/ext/new_allocator.h:103: note: candidates are: void __gnu_cxx::new_allocator<_Tp>::construct(_Tp*, const _Tp&) [with _Tp = test] ---------------------------------------------- -- Summary: class with operator& failed to be stored in the STL map Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: evgeny at mainsoft dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42105