Skip to content

Commit

Permalink
Issue 17419 - add __traits(getLinkage, s) to the the linkage of symbol s
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright authored and wilzbach committed Jun 7, 2017
1 parent 40a2ba3 commit 7b1e803
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions spec/traits.dd
Expand Up @@ -43,6 +43,7 @@ $(GNAME TraitsKeyword):
$(GBLINK getAttributes)
$(GBLINK getFunctionAttributes)
$(GBLINK getFunctionVariadicStyle)
$(GBLINK getLinkage)
$(GBLINK getMember)
$(GBLINK getOverloads)
$(GBLINK getPointerBitmap)
Expand Down Expand Up @@ -531,6 +532,33 @@ pragma(msg, __traits(getFunctionAttributes, (int x) @trusted { return x * 2; }))
---
)

$(H2 $(GNAME getLinkage))

$(P Takes one argument, which is a declaration symbol, or the type of a function,
delegate, or pointer to function.
Returns a string representing the $(LINK2 attribute.html#LinkageAttribute, LinkageAttribute)
of the declaration.
The string is one of:
)

$(UL
$(LI $(D "D"))
$(LI $(D "C"))
$(LI $(D "C++"))
$(LI $(D "Windows"))
$(LI $(D "Pascal"))
$(LI $(D "Objective-C"))
$(LI $(D "System"))
)

---
extern (C) int fooc();
alias aliasc = fooc;

static assert(__traits(getLinkage, fooc) == "C");
static assert(__traits(getLinkage, aliasc) == "C");
---

$(H2 $(GNAME getMember))

$(P Takes two arguments, the second must be a string.
Expand Down

0 comments on commit 7b1e803

Please sign in to comment.