public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/56437] New: basic_string assumes that allocators are default-constructible
@ 2013-02-24 23:40 tneumann at pi3 dot informatik.uni-mannheim.de
  2013-02-25  0:09 ` [Bug libstdc++/56437] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: tneumann at pi3 dot informatik.uni-mannheim.de @ 2013-02-24 23:40 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56437
           Summary: basic_string assumes that allocators are
                    default-constructible
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tneumann@pi3.informatik.uni-mannheim.de


Created attachment 29531
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29531
example

The empty-string optimization of basic_string assumes that allocators are
default constructible. While this used to be the case in C++98, it is no longer
true in C++11, as now allocators are allowed to have state.

Consider the attached example program. Compiling with

g++ -std=c++11 -c t.cpp

produces an error message, even though it should compile fine. The problem is
the the "_S_construct" calls "_Alloc()", which does not exist.

Note that the C++11 standard does not require default constructors. (Section
17.6.3.5, Table 28). In particular, the SimpleAllocator example from Section
17.6.3.5 would trigger the same bug, too.


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

end of thread, other threads:[~2014-12-22 13:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-24 23:40 [Bug libstdc++/56437] New: basic_string assumes that allocators are default-constructible tneumann at pi3 dot informatik.uni-mannheim.de
2013-02-25  0:09 ` [Bug libstdc++/56437] " redi at gcc dot gnu.org
2013-02-25  0:12 ` redi at gcc dot gnu.org
2013-02-25  6:32 ` tneumann at pi3 dot informatik.uni-mannheim.de
2013-02-25 11:18 ` paolo.carlini at oracle dot com
2014-09-19 11:00 ` redi at gcc dot gnu.org
2014-12-22 13:50 ` 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).