[LLVMbugs] [Bug 20508] New: basic_string does not respect NullablePointer requirements of the allocator's pointer

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Aug 1 02:38:11 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20508

            Bug ID: 20508
           Summary: basic_string does not respect NullablePointer
                    requirements of the allocator's pointer
           Product: libc++
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tkoeppe at google.com
                CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
    Classification: Unclassified

Created attachment 12843
  --> http://llvm.org/bugs/attachment.cgi?id=12843&action=edit
Compilation failure of basic_string with fancy pointer allocator

I'm attaching a complete example, but the problem is easily described:

The pointer type, std::allocator_traits<A>::pointer, is not required to be
trivially constructible. In fact, it is *impossible* for this type to be
trivially constructible if it is a class type, since it must value-initialize
to the null value.

However, the current implementation of basic_string assumes that the pointer
type is trivially constructible (since it puts the type into a union without
any user-provided constructors). This makes it impossible to use basic_string
with fancy pointers.

I haven't thought too much about a solution, but I think that adding suitable
constructors to the SSO union __rep and to the type __long would make this work
and wouldn't be too invasive a change.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140801/5fbb3903/attachment.html>


More information about the llvm-bugs mailing list