https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122036
--- Comment #4 from Witold Baryluk <witold.baryluk+gcc at gmail dot com> --- Also indeed, adding -fno-weak-templates as suggested in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102765 causes the issue to go away: ```d final class HashMap(K, V) { import core.builtins; static struct Slot { size_t hash_; import gcc.attributes : attribute; pragma(inline) @attribute("forceinline") bool Compare(size_t hash2) const { return hash_ == hash2; } } Slot[1] slots; import gcc.attributes : attribute; @attribute("flatten") Slot* GetWithHash(size_t hash) { Slot* slot = &slots[0]; if (slot.Compare(hash)) { return slot; } return null; } } alias HashMap0 = HashMap!(ulong, ulong); auto f(HashMap0 m) { return m.GetWithHash(5); } ``` Output: ``` "pure nothrow @nogc @safe example.HashMap!(ulong, ulong).HashMap.Slot* example.f(example.HashMap!(ulong, ulong).HashMap)": xor edx, edx cmp QWORD PTR [rdi+16], 5 lea rax, [rdi+16] cmovne rax, rdx ret ``` https://godbolt.org/z/z1xhj8dza
