summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/compilable/mixinTemplateMangling.d
blob: 3596a95c037afb7977d887d677e3e5c629e2aa94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// https://issues.dlang.org/show_bug.cgi?id=20012

mixin template mixinFoo() {

    extern(C) void cFoo() {}

    extern(C) int cVar;
    extern(D) int dVar;

    void dFoo() {}

    mixin(`mixin mixinBar;`); // test nesting and interaction with string mixins
}

mixin mixinFoo;

mixin template mixinBar() {
    extern(C) void cBar() {}
    void dBar() {}
}

static assert(cFoo.mangleof == "cFoo");
static assert(dFoo.mangleof == "_D21mixinTemplateMangling8__mixin54dFooFZv");
static assert(cVar.mangleof == "cVar");
static assert(dVar.mangleof == "_D21mixinTemplateMangling8__mixin54dVari");
static assert(cBar.mangleof == "cBar");
static assert(dBar.mangleof == "_D21mixinTemplateMangling8__mixin5Qj4dBarFZv");

struct S {
    mixin mixinFoo;
    static assert(cFoo.mangleof == "_D21mixinTemplateMangling1S8__mixin14cFooMUZv");
    static assert(cBar.mangleof == "_D21mixinTemplateMangling1S8__mixin18__mixin54cBarMUZv");
    static assert(dBar.mangleof == "_D21mixinTemplateMangling1S8__mixin18__mixin54dBarMFZv");
    static assert(dFoo.mangleof == "_D21mixinTemplateMangling1S8__mixin14dFooMFZv");
}