Re: [Boost-bugs] [Boost C++ Libraries] #11150: string_ref::to_string is necessarily UB for a default-constructed string_ref, despite stating no preconditions

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #11150: string_ref::to_string is necessarily UB for a default-constructed string_ref, despite stating no preconditions
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-03-28 18:56:02


#11150: string_ref::to_string is necessarily UB for a default-constructed
string_ref, despite stating no preconditions
--------------------------------+---------------------------
  Reporter: Tomalak Geret'kal | Owner: no-maintainer
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: utility
   Version: Boost 1.57.0 | Severity: Problem
Resolution: | Keywords:
--------------------------------+---------------------------

Comment (by marshall):

 Interestingly enough, this section of the standard `[string.cons]` has
 changed over time.

 Specifically the bit about this constructor:
     `basic_string(const charT* s, size_type n, const Allocator& a =
 Allocator());`

 C++03 and C++11 have the following requirement: "Requires: s shall not
 be a null pointer and n < npos"

 C++14 says instead: "Requires: s points to an array of at least n
 elements of charT."

 `{ NULL, 0 }` is allowable in the second case, but not in the first.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11150#comment:1>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:18 UTC