In writing bindings for libtorch, a C++ machine learning framework, I ran in to a seemingly artificial limitation.
I need to define external linkage for members of a class named Torch::Object. Unfortunately, the compiler will not let you declare a class named `Object` even if it is defined such that it would not collide with D's own Object the only "clean" way to do this (and only for non-virtual functions) is by manually specifying symbol names for each method with `pragma(mangle, ...)`.
If fixing this by changing the validation logic actually presents issues, perhaps adding a pragma, like mangle, that tells the compiler what class name to use when generating C++ symbols would be a good solution.
Comment #1 by robert.schadek — 2024-12-13T18:54:03Z