public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/48101] New: obscure error message with std::set<const int>
@ 2011-03-13 10:35 gdr at gcc dot gnu.org
  2011-03-13 12:24 ` [Bug libstdc++/48101] " redi at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: gdr at gcc dot gnu.org @ 2011-03-13 10:35 UTC (permalink / raw)
  To: gcc-bugs

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: unassigned@gcc.gnu.org
        ReportedBy: gdr@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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-03-10 14:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-13 10:35 [Bug libstdc++/48101] New: obscure error message with std::set<const int> gdr at gcc dot gnu.org
2011-03-13 12:24 ` [Bug libstdc++/48101] " redi at gcc dot gnu.org
2014-09-19 10:35 ` redi at gcc dot gnu.org
2014-09-19 13:31 ` redi at gcc dot gnu.org
2022-03-10 13:53 ` ldionne.2 at gmail dot com
2022-03-10 14:07 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).