mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 05:00:16 +03:00
fix Issue 23913 - __traits(getMember) fails for some C symbols (#15234)
This commit is contained in:
parent
2a650f7609
commit
16ec7b681b
3 changed files with 23 additions and 1 deletions
|
@ -13175,10 +13175,20 @@ Expression dotIdSemanticProp(DotIdExp exp, Scope* sc, bool gag)
|
|||
Expression se = new ScopeExp(exp.loc, imp.pkg);
|
||||
return se.expressionSemantic(sc);
|
||||
}
|
||||
|
||||
if (auto attr = s.isAttribDeclaration())
|
||||
{
|
||||
if (auto sm = ie.sds.search(exp.loc, exp.ident, flags))
|
||||
{
|
||||
auto es = new DsymbolExp(exp.loc, sm);
|
||||
return es;
|
||||
}
|
||||
}
|
||||
|
||||
// BUG: handle other cases like in IdentifierExp::semantic()
|
||||
debug
|
||||
{
|
||||
printf("s = '%s', kind = '%s'\n", s.toChars(), s.kind());
|
||||
printf("s = %p '%s', kind = '%s'\n", s, s.toChars(), s.kind());
|
||||
}
|
||||
assert(0);
|
||||
}
|
||||
|
|
5
compiler/test/compilable/imports/library.c
Normal file
5
compiler/test/compilable/imports/library.c
Normal file
|
@ -0,0 +1,5 @@
|
|||
typedef enum SomeEnum
|
||||
{
|
||||
foo = 0,
|
||||
bar = -10000,
|
||||
} SomeEnum;
|
7
compiler/test/compilable/test23913.d
Normal file
7
compiler/test/compilable/test23913.d
Normal file
|
@ -0,0 +1,7 @@
|
|||
// EXTRA_FILES: imports/library.c
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=23913
|
||||
|
||||
import imports.library;
|
||||
|
||||
alias x = __traits(getMember, imports.library, "SomeEnum");
|
Loading…
Add table
Add a link
Reference in a new issue