Hi, the gdc D compiler currently doesn't implement "non-POD" types. As in C++ those types can have copy constructors or destructors and should be kept in memory. Right now I just set TREE_ADDRESSABLE on the RECORD_TYPE tree and it's mostly working. Some test cases fail though if optimization / inlining is enabled:
D code like this: ------ Appender appender() { return Appender(""); } void main() { Appender w = appender(); auto x = &w; } ------ where Appender is a non-POD type causes an assertion failure in declare_return_variable: "gcc_assert (!TREE_ADDRESSABLE (callee_type));" There's a comment saying "All types requiring non-trivial constructors should have been handled." but where and how? The problem only occurs if the address of w is taken, as this will mark w as addressable. Then gimple_call_return_slot_opt_p test in expand_call_inline fails and return_slot is not set. If the address of w is not taken the return_slot is used and everything works fine. -fdump-tree-original dump: ------ ;; Function appender (_D6format8appenderFZS6format8Appender) ;; enabled by -tree-original { struct Appender __ctmp5; return <retval> = *format.Appender.this (&((void) (__ctmp5 = {});, __ctmp5), {.length=0, .ptr=""}); } ;; Function main (_Dmain) ;; enabled by -tree-original { struct Appender * x; struct Appender w; (void) (w = format.appender ()); (void) (x = &w); return <retval> = 0; } ------ Thanks, Johannes