| Issue |
203167
|
| Summary |
[clang][Modules] Assertion in ActOnAnnotModuleEnd: `unexpected submodule end in main file`
|
| Labels |
|
| Assignees |
|
| Reporter |
hongtaihu
|
This input is generated by a fuzzer.
```cxx
module M {
#pragma clang module build N
module N {
}
#pragma clang module contents
#pragma clang module begin N
template<typename U> struct X {
}
}
```
use
```
-std=c++2a -fmodules -fsyntax-only
```
This just causes an assertion, but it does not crash.
seems to be introduced since clang 5.
```
clang++: warning: argument unused during compilation: '-S' [-Wunused-command-line-argument]
<source>:1:10: error: unexpected preprocessing token '{' after module name, only ';' and '[' (start of attribute specifier sequence) are allowed
1 | module M {
| ^
<source>:2:22: error: no matching '#pragma clang module endbuild' for this '#pragma clang module build'
2 | #pragma clang module build N
| ^
N.map:6:2: error: expected ';' after struct
6 | }
| ^
| ;
N.map:7:1: error: extraneous closing brace ('}')
7 | }
| ^
N.map:4:22: error: no matching '#pragma clang module end' for this '#pragma clang module begin'
4 | #pragma clang module begin N
| ^
clang++: /root/llvm-project/llvm/tools/clang/lib/Sema/SemaModule.cpp:807: void clang::Sema::ActOnAnnotModuleEnd(clang::SourceLocation, clang::Module*): Assertion `File != getSourceManager().getMainFileID() && "end of submodule in main source file"' failed.
<source>:1:11: error: module directive must end with a ';'
1 | module M {
| ^
| ;
<source>:1:8: fatal error: module 'M' not found
1 | module M {
| ^
7 errors generated.
Compiler returned: 1
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs