On 18.04.2013 15:22, Daniel Murphy wrote:If I understand Agner Fog (http://www.agner.org/optimize/calling_conventions.pdf) correctly, "QB_NB" is parsed as QBtype with "QB" translating to "type *const" and type "_NB" translating to "const bool". So the const modifiers bind to different entities.
Hi all,
I have come across one strange case where dmd and dmc produce different
mangling for seemingly identical declarations.
D:
extern(C++) const(const(bool)*) gc_pi1; // mangled as ?gc_pi1@@3PB_NB
C++:
extern bool const * const gc_pi1; // mangled as ?gc_pi1@@3QB_NB
So we have '[PQ]B_NB' which translates to '[pointer/const pointer] const
bool const' where both of the const modifiers (for some reason) apply to
the bool, not the pointer.
I suspect dmd might be omitting the transitive "const" to allow leaving "const char *" as is instead of requiring "const(char)*" when translating C++ headers to D.Is dmd incorrectly printing 'P' instead of 'Q' or have I missed something?
cl 15.0 and 16.0 (from VS2008 and VS2010) mangle it the same as dmc:
Thanks,
Daniel.
PS If anybody with msvc installed could try this I would be very grateful.
error LNK2019: unresolved external symbol "bool const * const gc_pi1" (?gc_pi1@@3QB_NB) referenced in function _main