This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
libstdc++/10378: cannot add object with inplace new into STL collections
- From: nick dot brook at 3glab dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 11 Apr 2003 14:53:18 -0000
- Subject: libstdc++/10378: cannot add object with inplace new into STL collections
- Reply-to: nick dot brook at 3glab dot com
>Number: 10378
>Category: libstdc++
>Synopsis: cannot add object with inplace new into STL collections
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Apr 11 14:56:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: nick dot brook at 3glab dot com
>Release: 3.0.4
>Organization:
>Environment:
Linux (Debian testing)
>Description:
The following chunk of code doesn't compile - there seems to be a problem with adding objects that define a simple inplace new operator to STL collection classes. Note that the code WILL compile if the second new operator if defined instead of the first one. I first came across this when recompiling some code that uses IBM's ICU Unicode library, as their UnicodeString class now defines an inplace new & delete operator in the base class. This means i can't add UnicodeString objects to an STL list without amending the original ICU library.
>How-To-Repeat:
Just compile.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/x-c++src; name="tst.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="tst.cc"
I2luY2x1ZGUgPGxpc3Q+CiNpbmNsdWRlIDxzdHJpbmcuaD4KCmNsYXNzIEJvYgp7CnB1YmxpYzoK
ICAgIC8vIFdvbid0IGNvbXBpbGUgd2l0aCB0aGlzIG5ldyBvcGVyYXRvciAKICAgIHN0YXRpYyB2
b2lkICogb3BlcmF0b3IgbmV3KHNpemVfdCBzeikKICAgIHsKICAgICAgICByZXR1cm4gbWFsbG9j
KHN6KTsKICAgIH0KCgogICAgLy8gV2lsbCBjb21waWxlIHdpdGggdGhpcyBvcGVyYXRvcgovLyAg
ICAgc3RhdGljIHZvaWQgKiBvcGVyYXRvciBuZXcoc2l6ZV90IHN6LCB2b2lkICopCi8vICAgICB7
Ci8vICAgICAgICAgcmV0dXJuIG1hbGxvYyhzeik7Ci8vICAgICB9Cn07CgppbnQgbWFpbihpbnQg
YXJnYywgY2hhciAqKmFyZ3YpCnsKICAgIHN0ZDo6bGlzdDxCb2I+IHVuaXNldDsKICAgIHVuaXNl
dC5wdXNoX2JhY2soQm9iKCkpOwogICAgcmV0dXJuIDA7Cn0KCiAgICAK