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

* [Bug libstdc++/48101] obscure error message with std::set<const int>
  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 ` redi at gcc dot gnu.org
  2014-09-19 10:35 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2011-03-13 12:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-03-13 12:24:13 UTC ---
Do you have a suggestion for a better error?  We could use a static_assert in
std::allocator to reject const T

As far as I can see, the reason the code is invalid is exactly the reason
given: std::allocator can't be instantiated with const T.   I don't think it's
invalid to default construct a set::set with a const value_type, as long as
don't use std::allocator.


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

* [Bug libstdc++/48101] obscure error message with std::set<const int>
  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
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2014-09-19 10:35 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-09-19
     Ever confirmed|0                           |1
           Severity|normal                      |enhancement


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

* [Bug libstdc++/48101] obscure error message with std::set<const int>
  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
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2014-09-19 13:31 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |corey at octayn dot net

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 55963 has been marked as a duplicate of this bug. ***


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

* [Bug libstdc++/48101] obscure error message with std::set<const int>
  2011-03-13 10:35 [Bug libstdc++/48101] New: obscure error message with std::set<const int> gdr at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  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
  4 siblings, 0 replies; 6+ messages in thread
From: ldionne.2 at gmail dot com @ 2022-03-10 13:53 UTC (permalink / raw)
  To: gcc-bugs

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

Louis Dionne <ldionne.2 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ldionne.2 at gmail dot com

--- Comment #12 from Louis Dionne <ldionne.2 at gmail dot com> ---
FWIW, we now consider it a bug in libc++ that we accept std::allocator<const
T>, and we're trying to remove that "extension".

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

* [Bug libstdc++/48101] obscure error message with std::set<const int>
  2011-03-13 10:35 [Bug libstdc++/48101] New: obscure error message with std::set<const int> gdr at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-03-10 13:53 ` ldionne.2 at gmail dot com
@ 2022-03-10 14:07 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2022-03-10 14:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Nice!

^ 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).