mirror of
https://github.com/dlang/dmd.git
synced 2025-05-05 01:20:19 +03:00
Fix Bugzilla Issue 24504 - ImportC: Enum declarations with a mixture of int and uint literal values cause errors, when targeting Windows, when debug info generation is enabled. (#16385)
This commit is contained in:
parent
ee4f5a04ff
commit
f053ab07d0
2 changed files with 14 additions and 1 deletions
|
@ -325,7 +325,10 @@ void enumSemantic(Scope* sc, EnumDeclaration ed)
|
||||||
if (EnumMember em = s.isEnumMember())
|
if (EnumMember em = s.isEnumMember())
|
||||||
{
|
{
|
||||||
em.type = commonType;
|
em.type = commonType;
|
||||||
em.value = em.value.castTo(sc, commonType);
|
// optimize out the cast so that other parts of the compiler can
|
||||||
|
// assume that an integral enum's members are `IntegerExp`s.
|
||||||
|
// https://issues.dlang.org/show_bug.cgi?id=24504
|
||||||
|
em.value = em.value.castTo(sc, commonType).optimize(WANTvalue);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
10
compiler/test/compilable/test24504.c
Normal file
10
compiler/test/compilable/test24504.c
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
// REQUIRED_ARGS: -os=windows -g
|
||||||
|
// DISABLED: osx
|
||||||
|
// This is disabled on macOS because ld complains about _main being undefined
|
||||||
|
// when clang attempts to preprocess the C file.
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
HasIntAndUIntValuesInt = 0,
|
||||||
|
HasIntAndUIntValuesUInt = 0x80000000
|
||||||
|
} HasIntAndUIntValues;
|
Loading…
Add table
Add a link
Reference in a new issue