aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/compilable/cppmangle3.d
blob: 82c68f7a3a57b5f5a66fa0f66a509a953164697f (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// https://issues.dlang.org/show_bug.cgi?id=15512
// https://issues.dlang.org/show_bug.cgi?id=19893
// https://issues.dlang.org/show_bug.cgi?id=19920
module cppmangle3;

version (CppRuntime_Clang)       version = CppMangle_Itanium;
version (CppRuntime_DigitalMars) version = CppMangle_MSVC;
version (CppRuntime_Gcc)         version = CppMangle_Itanium;
version (CppRuntime_Microsoft)   version = CppMangle_MSVC;
version (CppRuntime_Sun)         version = CppMangle_Itanium;

extern(C++, "true")
{
}

extern(C++, "__traits")
{
}

extern(C++, "foo")
{
}

int foo; // no name clashing with above namespace

extern(C++, "std", "chrono")
{
    void func();
}

version(CppMangle_MSVC) static assert(func.mangleof == "?func@chrono@std@@YAXXZ");
else                    static assert(func.mangleof == "_ZNSt6chrono4funcEv");

struct Foo
{
    extern(C++, "namespace")
    {
        static void bar();
    }
}

alias Alias(alias a) = a;
alias Alias(T) = T;

static assert(is(Alias!(__traits(parent, Foo.bar)) == Foo));

extern(C++, "std"):
debug = def;
version = def;

extern(C++, "std")
{
    debug = def;
    version = def;
}

extern(C++, "foo")
extern(C++, "bar")
version = baz;