Issue 7472 - Cast from class to basic type not rejected during semantic

https://d.puremagic.com/issues/show_bug.cgi?id=7472