[LLVMbugs] [Bug 20008] New: clang-cl doesn't support the ui32 type suffix properly

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 11 20:03:08 PDT 2014


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

            Bug ID: 20008
           Summary: clang-cl doesn't support the ui32 type suffix properly
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ehsan at mozilla.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The headers that ship with MSVC define UINT32_MAX as 0xffffffffui32.  I'm not
100% sure what "ui32" is but I assume it denotes a uint32_t type.  It seems
like this confuses clang-cl a bit, which makes it a pain in places where for
example we call std::min with a uint32_t argument and a UINT32_MAX-1 argument. 
Here is a minimal test case demonstrating the issue:

#include <stdint.h>
template<class T> T min(T, T);
#define MAX 0xffffffffui32
void test() {
  uint32_t a;
  min(a, MAX - 1);
}

$ ./bin/clang-cl -c test.cpp
test.cpp(6,3) :  error: no matching function for call to 'min'
  min(a, MAX - 1);
  ^~~
test.cpp(2,21) :  note: candidate template ignored: deduced conflicting types
for parameter 'T' ('unsigned int' vs. 'unsigned long')
template<class T> T min(T, T);
                    ^
1 error generated.

-- 
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/20140612/157e75aa/attachment.html>


More information about the llvm-bugs mailing list