[Reg] fix Issue 13303 - Internal error: ..\ztc\cgcs.c 351 with rvalue Variant.get call

https://issues.dlang.org/show_bug.cgi?id=13303

This replaces https://github.com/D-Programming-Language/dmd/pull/3832 and includes its test cases.

Bugzilla 13303 is a duplicate of https://issues.dlang.org/show_bug.cgi?id=11763