<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - custom allocator and __pad_and_output from v1/locale"
   href="https://bugs.llvm.org/show_bug.cgi?id=40161">40161</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>custom allocator and __pad_and_output from v1/locale
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>6.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>moko@design.ru
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>In our code we are using basic_stringstream with custom allocator:

typedef std::basic_stringstream<char, std::char_traits<char>,
gc_allocator<char> > pa_stringstream;
typedef std::basic_string<char, std::char_traits<char>, gc_allocator<char> >
pa_string;

And we have checks for default new operator usage in our code:

void *new_disabled();
inline void *operator new[] (std::size_t){ return new_disabled(); }
inline void *operator new(std::size_t){ return new_disabled(); }

And with FreeBSD clang version 6.0.0 we get the following linker error:

table.C:(.text._ZNSt3__116__pad_and_outputIcNS_11char_traitsIcEEEENS_19ostreambuf_iteratorIT_T0_EES6_PKS4_S8_S8_RNS_8ios_baseES4_[_ZNSt3__116__pad_and_outputIcNS_11char_traitsIcEEEENS_19ostreambuf_iteratorIT_T0_EES6_PKS4_S8_S8_RNS_8ios_baseES4_]+0x9d):
undefined reference to `new_disabled()'

The issue is related to the following commit:
<a href="https://github.com/llvm-mirror/libcxx/commit/a585de645cccf1b8772c7efc8b77b6c1044ffe2c">https://github.com/llvm-mirror/libcxx/commit/a585de645cccf1b8772c7efc8b77b6c1044ffe2c</a>
Where the declaration is without allocator: basic_string<_CharT, _Traits>
__sp(__ns, __fl);
And if we simply comment out "if (__ns > 0)" fragment, the code compiles fine.

Note: there were not link error with previous clang (FreeBSD clang version
3.8.0), where the "locale" code is the same.
But may be the whole method was optimized out then.

If required, our full source code is available at
<a href="https://github.com/artlebedev/parser3/blob/master/src/classes/table.C">https://github.com/artlebedev/parser3/blob/master/src/classes/table.C</a></pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>