http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42056
--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-05-26 16:48:01 UTC --- Eh, I decided to ask when I saw your fix for 48599 involving type_uses_auto ;) Anyway, the below indeed appears to work pretty well. Is the error message Ok with you? Index: typeck2.c =================================================================== --- typeck2.c (revision 174295) +++ typeck2.c (working copy) @@ -1590,6 +1590,14 @@ build_functional_cast (tree exp, tree parms, tsubs else type = exp; + if (type_uses_auto (type)) + { + if (complain & tf_error) + error ("expected an expression"); + else + return error_mark_node; + } + /* We need to check this explicitly, since value-initialization of arrays is allowed in other situations. */ if (TREE_CODE (type) == ARRAY_TYPE)