-
-
Notifications
You must be signed in to change notification settings - Fork 609
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix Issue 17419 - add __traits(getLinkage, s) to the the linkage of s…
…ymbol s
- Loading branch information
1 parent
ae7a21b
commit f3dcdb4
Showing
4 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| // https://issues.dlang.org/show_bug.cgi?id=17419 | ||
|
|
||
|
|
||
| extern (C) int fooc(); | ||
| alias aliasc = fooc; | ||
|
|
||
| static assert(__traits(getLinkage, fooc) == "C"); | ||
| static assert(__traits(getLinkage, aliasc) == "C"); | ||
|
|
||
| extern (D) int food(); | ||
| extern (C++) int foocpp(); | ||
| extern (Windows) int foow(); | ||
| extern (Pascal) int foop(); | ||
| extern (Objective-C) int fooobjc(); | ||
| extern (System) int foos(); | ||
|
|
||
| static assert(__traits(getLinkage, food) == "D"); | ||
| static assert(__traits(getLinkage, foocpp) == "C++"); | ||
| static assert(__traits(getLinkage, foow) == "Windows"); | ||
| static assert(__traits(getLinkage, foop) == "Pascal"); | ||
| static assert(__traits(getLinkage, fooobjc) == "Objective-C"); | ||
| version (Windows) | ||
| static assert(__traits(getLinkage, foos) == "Windows"); | ||
| else | ||
| static assert(__traits(getLinkage, foos) == "C"); | ||
|
|
||
| extern (C) int global; | ||
| static assert(__traits(getLinkage, global) == "C"); | ||
|
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
|
|
||
| // https://issues.dlang.org/show_bug.cgi?id=17419 | ||
| /* TEST_OUTPUT: | ||
| --- | ||
| fail_compilation/fail17419.d(10): Error: argument to `__traits(getLinkage, 64)` is not a declaration | ||
| fail_compilation/fail17419.d(11): Error: expected 1 arguments for `getLinkage` but had 2 | ||
| --- | ||
| */ | ||
|
|
||
| enum s = __traits(getLinkage, 8 * 8); | ||
| enum t = __traits(getLinkage, 8, 8); | ||
|
|