yronglin wrote:

> I have doubts that this implements the wording of the papers.
> 
> Consider:
> 
> ```c++
> typedef int import;
> #define EMP
> EMP import m;
> ```
> 
> There is no introduction of an _import-keyword_ in the above. The utterance 
> of `import` remains an identifier after phase 4. The phase 7 grammar should 
> see `import` as a _typedef-name_.
> 
> Yet:
> 
> ```
> $ clang++ importIdentifier.cc -std=c++26 -fsyntax-only
> importIdentifier.cc:3:5: error: the import directive is ill-formed, import 
> keyword must be immediately followed on the same line by an identifier, '<', 
> '"', or ':', but
>       not '::', after being at the start of a line or preceded by an export 
> at the start of the line
>     3 | EMP import m;
>       |     ^
> importIdentifier.cc:3:12: fatal error: module 'm' not found
>     3 | EMP import m;
>       |            ^~
> 2 errors generated.
> Return:  0x01:1   Wed Sep 17 23:06:08 2025 EDT
> ```

Good catch! We hit this issue here because parser try to do error recovery, We 
need to do more good error recovery here, or can we remove the module 
import/module declare error recovery in the current patch, what do you think?

https://github.com/llvm/llvm-project/pull/107168
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to