<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 --- - Placement new mistakenly typedefs char16_t and char32_t when compiling using c++98"
   href="http://llvm.org/bugs/show_bug.cgi?id=21307">21307</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Placement new mistakenly typedefs char16_t and char32_t when compiling using c++98
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </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>kulakov.ilya@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu, mclow.lists@gmail.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following piece of code:

    #include <new>
    #include <stdint.h>

    typedef uint32_t char32_t;
    typedef uint16_t char16_t;

    int main()
    {
    return 0;
    }

cannot be compiled with the following flags set: -stdlib=libc++ -std=c++98
The errors I get:
    main.cpp:4:18: error: typedef redefinition with different types ('uint32_t'
(aka 'unsigned int') vs 'char32_t')
    typedef uint32_t char32_t;
                 ^
   
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:227:20:
note: previous definition is here
    typedef __char32_t char32_t;
                   ^
    main.cpp:5:18: error: typedef redefinition with different types ('uint16_t'
(aka 'unsigned short') vs 'char16_t')
    typedef uint16_t char16_t;
                 ^
   
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:226:20:
note: previous definition is here
    typedef __char16_t char16_t;

Mac OS X: 10.9.5 with all updates installed
clang: AppleClang 6.0.0.6000051
libc++ as reported by tool -l: 120.0.0

If I switch -stdlib to libstdc++ it compiles just fine.


Looks like including the new header file causes to include some C++11 header
files which in turn defines char16_t and char32_t. My understanding is that
libc++ thinks that placement new is C++11 feature for some reason.

                   ^</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>