https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104113
--- Comment #6 from qingzhe huang <nickhuang99 at hotmail dot com> --- How about this simple fix? (see the patch above.) Instead of return "error_mark_node" by condition of "!cp_parser_simulate_error", we now report error immediately. The rational of this fix is that "cp_parser_simulate_error" is only making sense when we already see error, i.e. "CP_PARSER_STATUS_KIND_ERROR". Otherwise, we should just report error. I did a full build and check, it seems fine with me. For example, 104091.cpp: In function ‘void g()’: 104091.cpp:8:7: error: ‘auto’ not permitted in template argument 8 | A<auto> x = A<short>(); | ^~~~ 104091.cpp:8:13: error: variable ‘A<auto> x’ has initializer but incomplete type 8 | A<auto> x = A<short>(); | ^ Also I noticed previous testcase (i.e. g++.dg/DRs/dr625.C) is too relaxed with error message by allowing inaccurate "invalid template argument" or "cannot convert ..." instead of "auto not permitted". If this makes sense to you, I am happy to provide more testcases and correct those old testcases.