fix sets of scoped imported enums (#13666)
This commit is contained in:
parent
bec0522fca
commit
6a23452bf4
3 changed files with 14 additions and 1 deletions
|
|
@ -880,7 +880,8 @@ proc getTypeDescAux(m: BModule, origTyp: PType, check: var IntSet): Rope =
|
||||||
m.s[cfsTypes].add(recdesc)
|
m.s[cfsTypes].add(recdesc)
|
||||||
elif tfIncompleteStruct notin t.flags: addAbiCheck(m, t, result)
|
elif tfIncompleteStruct notin t.flags: addAbiCheck(m, t, result)
|
||||||
of tySet:
|
of tySet:
|
||||||
result = $t.kind & '_' & getTypeName(m, t.lastSon, hashType t.lastSon)
|
# Don't use the imported name as it may be scoped: 'Foo::SomeKind'
|
||||||
|
result = $t.kind & '_' & t.lastSon.typeName & $t.lastSon.hashType
|
||||||
m.typeCache[sig] = result
|
m.typeCache[sig] = result
|
||||||
if not isImportedType(t):
|
if not isImportedType(t):
|
||||||
let s = int(getSize(m.config, t))
|
let s = int(getSize(m.config, t))
|
||||||
|
|
|
||||||
3
tests/cpp/enum.hpp
Normal file
3
tests/cpp/enum.hpp
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
namespace namespaced {
|
||||||
|
enum Enum { A, B, C };
|
||||||
|
}
|
||||||
9
tests/cpp/tenum_set.nim
Normal file
9
tests/cpp/tenum_set.nim
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
discard """
|
||||||
|
targets: "cpp"
|
||||||
|
output: "{A, B, C}"
|
||||||
|
"""
|
||||||
|
|
||||||
|
type Enum {.importcpp: "namespaced::Enum", header: "enum.hpp".} = enum A, B, C
|
||||||
|
|
||||||
|
var vals = {low(Enum) .. high(Enum)}
|
||||||
|
echo vals
|
||||||
Loading…
Add table
Add a link
Reference in a new issue