Wrong types in create-temporary rewrites (CommaExp) wrt. `alias this`
It is alleged that this is a frontend issue that breaks LDC: https://github.com/ldc-developers/ldc/issues/4882
Test case from https://github.com/ldc-developers/ldc/issues/4246#issuecomment-1308175222:
struct Result(Type) {
Type get() { assert(0); }
alias get this;
this(ref Result) {}
}
float dotProduct() {
Result!float got;
return got;
}
The got in return got; is rewritten to: (float __copytmp2 = got.get(); __copytmp2). The type of the overall CommaExp is Result!float (instead of float), and so is the 2nd nested expression's (__copytmp2).
Additionally, the temporary isn't required - it's a trivial float. Result!float is no POD because of the copy ctor, I guess that tricks the frontend into thinking it has to create a float temporary (because it's using the wrong Result!float type, not float).
This is constantly creating ICE in LDC; someone needs to fix this...
So, is this fixed now? Does DMD need to take any action? I thought it was said the problem was a DMD bug, but it seems they fixed it in LDC?
Just because the DMD codegenerator doesn't hick up on the wrong AST types doesn't mean this is an LDC issue.