[clang] [libcxx] [llvm] Reapply "[Clang] Implement resolution for CWG1835 (#92957)" (PR #98547)

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 15 00:37:41 PDT 2024


hokein wrote:

> @pranavk see #98613.
> 
> edit: sorry, the error recovery that is currently performed will not detect cases where the template argument list does not contain a a type. i can look into this monday.

Some analysis:

given the example `this->StorageT<I>` where `I` is an `int`, the error recovery mechanism uses `isTemplateArgumentList` [here](https://github.com/llvm/llvm-project/blob/main/clang/lib/Parse/ParseExprCXX.cpp#L563) to check if the current token sequence `< I >` forms a `< template-argument-list >`. However, since `I` is an expression, this becomes an ambiguous caseā€”it could be interpreted as a less than comparison. Consequently, the error recovery doesn't activate for this case, and a hard error is emitted.

We might be able to tweak or improve the heuristic, but I don't have a good idea for an easy fix.

https://github.com/llvm/llvm-project/pull/98547


More information about the cfe-commits mailing list