<html>
    <head>
      <base href="https://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 --- - Cannot call std::string::~string explicitly"
   href="https://llvm.org/bugs/show_bug.cgi?id=25992">25992</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Cannot call std::string::~string explicitly
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>yasserasmi@live.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Test case:
#include <new>
#include <type_traits>
#include <string>

int main() {
    std::aligned_storage<sizeof(std::string)>::type storage;

    std::string* obj = new(&storage) std::string;

    using namespace std; // Workaround #1:Without this line, clang fails.
    obj->std::string::~string();
}

Workarounds:
#1: Using namespace std;
#2: Calling ~basic_string() instead of ~string()

The code works on GCC without workarounds.

Compiler details:
gcc --version Configured with: --prefix=/Library/Developer/CommandLineTools/usr
--with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 7.0.2
(clang-700.1.81) Target: x86_64-apple-darwin15.2.0 Thread model: posix

More details:
<a href="http://stackoverflow.com/questions/34560903/mac-gcc-doesnt-allow-calling-stdstringstring-explicitly">http://stackoverflow.com/questions/34560903/mac-gcc-doesnt-allow-calling-stdstringstring-explicitly</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>