Skip to content

Commit

Permalink
Merge pull request #9892 from thewilsonator/issue-19557
Browse files Browse the repository at this point in the history
fix Issue 19557 - extern(C++, ns) and extern(C++, class) interact weird
merged-on-behalf-of: Jacob Carlborg <jacob-carlborg@users.noreply.github.com>
  • Loading branch information
dlang-bot committed May 28, 2019
2 parents 0b606ca + 0b050b7 commit 920fa49
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/dmd/parse.d
Original file line number Diff line number Diff line change
Expand Up @@ -934,12 +934,15 @@ final class Parser(AST) : Lexer
{
error("conflicting linkage `extern (%s)` and `extern (%s)`", AST.linkageToChars(pAttrs.link), AST.linkageToChars(link));
}
else if (idents || identExps)
else if (idents || identExps || cppmangle != CPPMANGLE.def)
{
// Allow:
// extern(C++, foo) extern(C++, bar) void foo();
// to be equivalent with:
// extern(C++, foo.bar) void foo();
// Allow also:
// extern(C++, "ns") extern(C++, class) struct test {}
// extern(C++, class) extern(C++, "ns") struct test {}
}
else
error("redundant linkage `extern (%s)`", AST.linkageToChars(pAttrs.link));
Expand Down
10 changes: 10 additions & 0 deletions test/compilable/test19557.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// https://issues.dlang.org/show_bug.cgi?id=19557
// Error: redundant linkage `extern (C++)`

extern(C++, "ns")
extern(C++, class)
struct test {}

extern(C++, class)
extern(C++, "ns")
struct test2 {}

0 comments on commit 920fa49

Please sign in to comment.