Automatically avoid trivial Castclass