[LLVMbugs] [Bug 21307] New: Placement new mistakenly typedefs char16_t and char32_t when compiling using c++98

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Oct 17 16:02:30 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=21307

            Bug ID: 21307
           Summary: Placement new mistakenly typedefs char16_t and
                    char32_t when compiling using c++98
           Product: libc++
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kulakov.ilya at gmail.com
                CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
    Classification: Unclassified

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.

                   ^

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141017/bfe75062/attachment.html>


More information about the llvm-bugs mailing list