fix Issue 12524 - wrong type with inout const arg and inout return
Merge pull request #3457 from 9rnsr/fix12524

Issue 12524 - wrong type with inout const arg and inout return