Created
May 23, 2015 21:00
-
-
Save gchatelet/52406822c73aaa4ab6c7 to your computer and use it in GitHub Desktop.
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
version(linux): | |
extern(C++) { | |
struct elem9 { } | |
void foobar9(elem9*, elem9*); | |
static assert(foobar9.mangleof == "_Z7foobar9P5elem9S0_"); | |
} | |
extern (C++) | |
{ | |
void test10058a(void*) { } | |
static assert(test10058a.mangleof == "_Z10test10058aPv"); | |
void test10058b(void function(void*)) { } | |
static assert(test10058b.mangleof == "_Z10test10058bPFvPvE"); | |
void test10058c(void* function(void*)) { } | |
static assert(test10058c.mangleof == "_Z10test10058cPFPvS_E"); | |
void test10058d(void function(void*), void*) { } | |
static assert(test10058d.mangleof == "_Z10test10058dPFvPvES_"); | |
void test10058e(void* function(void*), void*) { } | |
static assert(test10058e.mangleof == "_Z10test10058ePFPvS_ES_"); | |
void test10058f(void* function(void*), void* function(void*)) { } | |
static assert(test10058f.mangleof == "_Z10test10058fPFPvS_ES1_"); | |
void test10058g(void function(void*), void*, void*) { } | |
static assert(test10058g.mangleof == "_Z10test10058gPFvPvES_S_"); | |
void test10058h(void* function(void*), void*, void*) { } | |
static assert(test10058h.mangleof == "_Z10test10058hPFPvS_ES_S_"); | |
void test10058i(void* function(void*), void* function(void*), void*) { } | |
static assert(test10058i.mangleof == "_Z10test10058iPFPvS_ES1_S_"); | |
void test10058j(void* function(void*), void* function(void*), void* function(void*)) { } | |
static assert(test10058j.mangleof == "_Z10test10058jPFPvS_ES1_S1_"); | |
void test10058k(void* function(void*), void* function(const (void)*)) { } | |
static assert(test10058k.mangleof == "_Z10test10058kPFPvS_EPFS_PKvE"); | |
void test10058l(void* function(void*), void* function(const (void)*), const(void)* function(void*)) { } | |
static assert(test10058l.mangleof == "_Z10test10058lPFPvS_EPFS_PKvEPFS3_S_E"); | |
} | |
extern(C++) { | |
// free functions - test parameters | |
void a0(); | |
static assert(a0.mangleof == "_Z2a0v"); | |
void b0(int); | |
static assert(b0.mangleof == "_Z2b0i"); | |
void b1(int*); | |
static assert(b1.mangleof == "_Z2b1Pi"); | |
void b2(int[3]); | |
static assert(b2.mangleof == "_Z2b2Pi"); | |
void b3(int**); | |
static assert(b3.mangleof == "_Z2b3PPi"); | |
void c0(const int); | |
static assert(c0.mangleof == "_Z2c0i"); | |
void c1(const(int*)); | |
static assert(c1.mangleof == "_Z2c1PKi"); | |
void c2(const(int)*); | |
static assert(c2.mangleof == "_Z2c2PKi"); | |
void d0(ref int); | |
static assert(d0.mangleof == "_Z2d0Ri"); | |
void d1(const ref int); | |
static assert(d1.mangleof == "_Z2d1RKi"); | |
// struct member functions | |
struct Struct { | |
void foo(); | |
static assert(foo.mangleof == "_ZN6Struct3fooEv"); | |
void const_foo() const; | |
static assert(const_foo.mangleof == "_ZNK6Struct9const_fooEv"); | |
} | |
void e0(ref Struct); | |
static assert(e0.mangleof == "_Z2e0R6Struct"); | |
void e1(Struct); | |
static assert(e1.mangleof == "_Z2e16Struct"); | |
// class is mangled as pointer to class (reference semantic in D) | |
class Class {} | |
void f0(Class); | |
static assert(f0.mangleof == "_Z2f0P5Class"); | |
// free function templates | |
void t0(T)(); | |
static assert(t0!int.mangleof == "_Z2t0IiEvv"); | |
static assert(t0!(TStruct!(TStruct!(TStruct!int))).mangleof == "_Z2t0I7TStructIS0_IS0_IiEEEEvv"); | |
void t1(T)(T); | |
static assert(t1!int.mangleof == "_Z2t1IiEvT_"); | |
void t2(A,B,C)(A,ref B,C); | |
static assert(t2!(int,char,uint).mangleof == "_Z2t2IicjEvT_RT0_T1_"); | |
T t3(T)(T, T); | |
static assert(t3!int.mangleof == "_Z2t3IiET_S0_S0_"); | |
// template struct | |
struct TStruct(A) { | |
void f0(); | |
void f1(A); | |
void f2() const; | |
struct Inner(B) { | |
void g0(A, B); | |
void g1(A, B) const; | |
} | |
} | |
static assert(TStruct!int.f0.mangleof == "_ZN7TStructIiE2f0Ev"); | |
static assert(TStruct!int.f1.mangleof == "_ZN7TStructIiE2f1Ei"); | |
static assert(TStruct!int.f2.mangleof == "_ZNK7TStructIiE2f2Ev"); | |
static assert(TStruct!int.Inner!char.g0.mangleof == "_ZN7TStructIiE5InnerIcE2g0Eic"); | |
static assert(TStruct!int.Inner!char.g1.mangleof == "_ZNK7TStructIiE5InnerIcE2g1Eic"); | |
static assert(TStruct!int.Inner!int.g0.mangleof == "_ZN7TStructIiE5InnerIiE2g0Eii"); | |
static assert(TStruct!(Struct).Inner!(Struct).g0.mangleof == "_ZN7TStructI6StructE5InnerIS0_E2g0ES0_S0_"); | |
struct A {} | |
struct B {} | |
struct C(TC) { | |
TC foo(TC); | |
} | |
static assert(C!int.foo.mangleof == "_ZN1CIiE3fooEi"); | |
static assert(C!A.foo.mangleof == "_ZN1CI1AE3fooES0_"); | |
static assert(C!(C!A).foo.mangleof == "_ZN1CIS_I1AEE3fooES1_"); | |
struct D(TD1, TD2) { | |
TD1 foo(TD1, TD2, TD1, TD2); | |
struct E { | |
char bar(TD3)(TD1,TD2,TD3); | |
} | |
} | |
static assert(D!(int, int).foo.mangleof == "_ZN1DIiiE3fooEiiii"); | |
static assert(D!(int, A).foo.mangleof == "_ZN1DIi1AE3fooEiS0_iS0_"); | |
static assert(D!(A, A).foo.mangleof == "_ZN1DI1AS0_E3fooES0_S0_S0_S0_"); | |
static assert(D!(A, B).foo.mangleof == "_ZN1DI1A1BE3fooES0_S1_S0_S1_"); | |
// static assert(D!(A, B).E.bar!A.mangleof == "_ZN1DI1A1BE1E3barIS0_EEcS0_S1_T_"); | |
void baz(A, B, C)(); | |
static assert(baz!(A, C!A, A).mangleof == "_Z3bazI1A1CIS0_ES0_Evv"); | |
static assert(baz!(int, C!int, int).mangleof == "_Z3bazIi1CIiEiEvv"); | |
// void barbaz(char (::D<A,B>::E::*)(A,B,A)); | |
// static assert(barbaz.mangleof == "_Z6barbazMN1DI1A1BE1EEFcS0_S1_S0_E"); | |
// | |
// void barbazt(T)(char (::D<T,B>::E::*)(T,B,T)); | |
// static assert(barbazt!A.mangleof == "_Z7barbaztI1AEvMN1DIT_1BE1EEFcS2_S3_S2_E"); | |
} | |
extern(C++, ns) { | |
void ns_a0(); static assert(ns_a0.mangleof == "_ZN2ns5ns_a0Ev"); | |
} | |
extern(C++, ns0.ns1.ns2) { | |
void ns0_ns1_ns2_a0(); static assert(ns0_ns1_ns2_a0.mangleof == "_ZN3ns03ns13ns214ns0_ns1_ns2_a0Ev"); | |
} | |
extern(C++, nested) { | |
struct NestedStruct {} | |
void nested0(NestedStruct); static assert(nested0.mangleof == "_ZN6nested7nested0ENS_12NestedStructE"); | |
struct NestedTemplatedStruct(A) { | |
B* templatedMemberFunction(B)(const(B)**) const; | |
}; | |
// nested S_ | |
// NestedTemplatedStruct S0_ | |
// NestedTemplatedStruct!int S1_ | |
// templatedMemberFunction!char S2_ | |
// char S3_ | |
static assert(NestedTemplatedStruct!int.templatedMemberFunction!char.mangleof == "_ZNK6nested21NestedTemplatedStructIiE23templatedMemberFunctionIcEEPT_PPKS3_"); | |
// nested S_ | |
// NestedTemplatedStruct S0_ | |
// NestedTemplatedStruct!int S1_ | |
// templatedMemberFunction!NestedStruct S2_ | |
// NestedStruct S3_ | |
// static assert(NestedTemplatedStruct!int.templatedMemberFunction!NestedStruct.mangleof == "_ZNK6nested21NestedTemplatedStructIiE23templatedMemberFunctionINS_12NestedStructEEEPT_PPKS4_"); | |
} | |
extern(C++, std) { | |
struct allocator(T) { } | |
struct char_traits(CharT) { } | |
struct basic_string(T, TRAITS = char_traits!T, ALLOC = allocator!T) { | |
bool empty() nothrow const; | |
size_t find_first_of(ref const basic_string str, size_t pos = 0) nothrow const; | |
} | |
struct basic_istream(T, TRAITS = char_traits!T) { | |
int get(); | |
} | |
struct basic_ostream(T, TRAITS = char_traits!T) { | |
ref basic_ostream put(char); | |
} | |
struct basic_iostream(T, TRAITS = char_traits!T) { | |
} | |
struct vector(T, A = allocator!T) | |
{ | |
void push_back(ref const T); | |
bool empty() const; | |
} | |
void foo14(std.vector!(int) p); | |
} | |
alias basic_string!char std_string; | |
alias basic_istream!char std_istream; | |
alias basic_ostream!char std_ostream; | |
alias basic_iostream!char std_iostream; | |
static assert(std.vector!int.empty.mangleof); | |
static assert(std_istream.get.mangleof == "_ZNSi3getEv"); | |
static assert(std_ostream.put.mangleof == "_ZNSo3putEc"); | |
static assert(std_string.empty.mangleof == "_ZNKSs5emptyEv"); | |
static assert(std_string.find_first_of.mangleof == "_ZNKSs13find_first_ofERKSsm"); | |
static assert(std.foo14.mangleof == "_ZSt5foo14St6vectorIiSaIiEE"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment