fix Issue 11317 - glue.c:1218: virtual unsigned int Type::totym(): Assertion `0' failed.

Make ref-ness deduction and return type inference orthogonal.
Merge pull request #2766 from 9rnsr/fix11317

Issue 11317 - glue.c:1218: virtual unsigned int Type::totym(): Assertion `0' failed.