Consider: ----- struct S() { int test() { pragma(msg, test.mangleof); return 3; } } S!() s; ----- This should give an error, because attributes that affect mangling are not known until the semantic analysis is complete.
@WalterBright created dlang/dmd pull request #10961 "Fix Issue 20696 - Should error when retrieving mangling while the typ…" fixing this issue: - Fix Issue 20696 - Should error when retrieving mangling while the type is not yet final https://github.com/dlang/dmd/pull/10961
Looks like a duplicate of https://issues.dlang.org/show_bug.cgi?id=15431
15431 is related, but a different problem requiring a different solution.
dlang/dmd pull request #10961 "Fix Issue 20696 - Should error when retrieving mangling while the typ…" was merged into master: - c4e6520f862b80dbb3756c05c29a4fcd25aa7d5d by Walter Bright: Fix Issue 20696 - Should error when retrieving mangling while the type is not yet final https://github.com/dlang/dmd/pull/10961