Hi, The problem here is that right after groktypename we take the TYPE_MAIN_VARIANT of the result which is incorrect. There needs a check for error_mark_node. This adds the obvious check and fixes the ICE.
OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. Thanks, Andrew Pinski ChangeLog: * c-parser.c (c_parser_postfix_expression): Check groktypename results before looking at the main variant. testsuite/ChangeLog: * testsuite/gcc.dg/pr51321.c: New testcase