public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gdr at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/48101] New: obscure error message with std::set<const int>
Date: Sun, 13 Mar 2011 10:35:00 -0000	[thread overview]
Message-ID: <bug-48101-4@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2011-03-13 10:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-13 10:35 gdr at gcc dot gnu.org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-48101-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).