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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to