http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48101

           Summary: obscure error message with std::set<const int>
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: g...@gcc.gnu.org


The error message displayed on the
following program is quite obscure
and has no apparent relation with
the actual error.  Quite mystifying.

#include <set>

int main() {
  std::set<const int> s;
}

With my system compiler (GCC-4.5), I get:

In file included from
/usr/include/c++/4.5/x86_64-suse-linux/bits/c++allocator.h:34:0,
                 from /usr/include/c++/4.5/bits/allocator.h:48,
                 from /usr/include/c++/4.5/bits/stl_tree.h:63,
                 from /usr/include/c++/4.5/set:60,
                 from b.C:1:
/usr/include/c++/4.5/ext/new_allocator.h: In instantiation of
‘__gnu_cxx::new_allocator<const int>’:
/usr/include/c++/4.5/bits/allocator.h:87:5:   instantiated from
‘std::allocator<const int>’
/usr/include/c++/4.5/bits/stl_set.h:90:61:   instantiated from ‘std::set<const
int>’
b.C:4:24:   instantiated from here
/usr/include/c++/4.5/ext/new_allocator.h:79:7: error: ‘const _Tp*
__gnu_cxx::new_allocator<_Tp>::address(const _Tp&) const [with _Tp = const int,
const _Tp* = const int*, const _Tp& = const int&]’ cannot be overloaded
/usr/include/c++/4.5/ext/new_allocator.h:76:7: error: with ‘_Tp*
__gnu_cxx::new_allocator<_Tp>::address(_Tp&) const [with _Tp = const int, _Tp*
= const int*, _Tp& = const int&]’


Go and figure out what the actual error was (hint: use of 'const int')
when the compiler displays internals of libstdc++ with unoverloadable
address of operator (which the user never overloaded in the first place.)

-- Gaby

Reply via email to