<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </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 --- - Spurious warnings from std::u16string, std::u32string"
   href="http://llvm.org/bugs/show_bug.cgi?id=17866">17866</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Spurious warnings from std::u16string, std::u32string
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>Static Analyzer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>kremenek@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>j4cbo@dropbox.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>operator+= on std::u16string gives me the following warning buried deep in
std::u16string: "Argument to operator delete is the address of a local stack
variable, which is not memory allocated by 'new'"

Here's a simple test case, and the result of running it with the checker-275
bundle:

$ cat test.cpp 
#include <string>
void test() {
    std::u16string s;
    s += 'a';
}

$ ~/src/checker-275/scan-build clang++ -c test.cpp -std=c++11 -stdlib=libc++ \
 
'-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include'
-o test
scan-build: Using '/Users/j4cbo/src/checker-275/bin/clang' for static analysis
In file included from test.cpp:1:
In file included from
/Users/j4cbo/src/checker-275/bin/../lib/c++/v1/string:434:
In file included from
/Users/j4cbo/src/checker-275/bin/../lib/c++/v1/algorithm:594:
/Users/j4cbo/src/checker-275/bin/../lib/c++/v1/memory:1676:10: warning:
Argument to operator delete is the address of a local stack variable, which is
not memory allocated by 'new'
        {::operator delete((void*)__p);}
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
scan-build: Removing directory
'/var/folders/gp/2n2s5sbn54vgg6vs4rsmqpynyr_mb4/T/scan-build-2013-11-09-12'
because it contains no reports.
scan-build: No bugs found.

(The built-in checker in XCode 5 gives the same warning, with much better
output about the intermediate call path, but that's a lot harder to paste into
a bug report...)

std::u32string causes the same error, but std::string does not.</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>