1 /** 2 TEST_OUTPUT: 3 --- 4 --- 5 */ 6 module cppmangle3; 7 8 9 extern(C++, "true") 10 { 11 } 12 13 extern(C++, "__traits") 14 { 15 } 16 17 extern(C++, "foo") 18 { 19 } 20 21 int foo; // no name clashing with above namespace 22 23 extern(C++, "std", "chrono") 24 { 25 void func(); 26 } 27 28 version(Windows) static assert(func.mangleof == "?func@chrono@std@@YAXXZ"); 29 else static assert(func.mangleof == "_ZNSt6chrono4funcEv"); 30 31 struct Foo 32 { 33 extern(C++, "namespace") 34 { 35 static void bar(); 36 } 37 } 38 39 alias Alias(alias a) = a; 40 alias Alias(T) = T; 41 42 static assert(is(Alias!(__traits(parent, Foo.bar)) == Foo)); 43 44 extern(C++, "std"): 45 debug = 456; 46 debug = def; 47 version = 456; 48 version = def; 49 50 extern(C++, "std") 51 { 52 debug = 456; 53 debug = def; 54 version = 456; 55 version = def; 56 } 57 58 extern(C++, "foo") 59 extern(C++, "bar") 60 version = baz;