https://issues.dlang.org/show_bug.cgi?id=15587
Tim <tim.dl...@t-online.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tim.dl...@t-online.de --- Comment #4 from Tim <tim.dl...@t-online.de> --- Using `pragma(mangle)` is also annoying for type names, because every function using the renamed type needs to use the changed mangling. This is for example necessary for `std::function`, because `function` is a keyword in D. It would be nice if you could change the mangled name of a type once and every function using the type gets the changed name automatically. It could look something like this: ``` import core.stdcpp.xutility : StdNamespace; import std.traits; extern(C++, (StdNamespace)) extern(C++, class) pragma(mangle_name, "function") // This type is called function in C++ struct std_function(F) { // ... } extern(C++) void f(ref const std_function!(FunctionTypeOf!(void function())) callback); ``` Currently every function like `f` using `std_function` would need `pragma(mangle)` and the exact mangling depends on operating system and processor architecture. It is possible to generate the correct mangling using CTFE, but this still needs to be done for every function. --