[cfe-dev] Clang python bindings tests failing on Windows7/MSVC10

Evan P hiwrac at gmail.com
Mon Apr 16 02:08:50 PDT 2012

When running the tests for the clang python bindings on windows 7 (x64,
clang built with MSVC 10).   This failure does not occur on Linux (Mint 12,
clang built with gcc 4.6.1)

FAIL: tests.cindex.test_cursor.test_enum_type
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\nose-1.1.2-py2.7.egg\nose\case.py",
line 1
97, in runTest
cursor.py", line 110, in test_enum_type
    assert enum_type.kind == TypeKind.UINT

The full test:

def test_enum_type():
    tu = get_tu('enum TEST { FOO=1, BAR=2 };')
    enum = get_cursor(tu, 'TEST')
    assert enum is not None

    assert enum.kind == CursorKind.ENUM_DECL
    enum_type = enum.enum_type
    assert enum_type.kind == TypeKind.UINT

The assert is failing because the version compiled under MSVC
enum_type.kind is TypeKind.INT instead of TypeKind.UINT

I see 2 possibilities, and I am not sure which is correct (possibly both):

1) This is simply an overzealous test, according to
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf (7.2.6)
(pg 156) an unscoped enum does not required a fixed type and can be any
integral type that can accommodate all enum values with the exception it is
not larger than int/unsigned int unless it has to be to  accommodate all

2) There is an inconsistency in the way clang handles enum definitions when
built with MSVC10 vs GCC4.6.

Can anyone shed some light on this, and point me in a direction to help
resolve this?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120416/6e6ab1ff/attachment.html>

More information about the cfe-dev mailing list