[LLVMbugs] [Bug 9792] New: [C++][Win] wchar_t may be "unsigned short", not "signed short" for Win32

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 25 04:12:05 PDT 2011


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

           Summary: [C++][Win] wchar_t may be "unsigned short", not
                    "signed short" for Win32
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: geek4civic at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


With clang++ C++ mode, it seems wchar_t is defined as signed short for Win32
targets.

I have been attempting to build libcxx with clang++ on mingw32.

in libcxx/include/limits,

    static const bool is_signed = type(-1) < type(0);
    static const int  digits = static_cast<int>(sizeof(type) * __CHAR_BIT__ -
is_signed);
    static const int  digits10 = digits * 3 / 10;
    static const int  max_digits10 = 0;
    static const type __min = __libcpp_compute_min<type, digits,
is_signed>::value;
    static const type __max = is_signed ? type(type(~0) ^ __min) : type(~0);


in
libcxx/test/language.support/support.limits/limits/numeric.limits.members/min.pass.cpp,
std::numeric_limits<wchar_t>::min() is expected 0 but I got -32768.


I wonder whether I might tweak lib/ASTContext.cpp, or give cc1 -fshort-wchar.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list