Issue 57293
Summary [clang] Module interface unavailable when specified by name
Labels new issue
Assignees
Reporter aaronmondal
    I am not sure whether this is a bug or working as intended. I suspect the former.

Consider a module with separate interface and implementation:
```bash
echo "export module mymodule;" > mymodule.cppm
echo "module mymodule;" > mymodule.cpp
```

This compiles fine when using the following commands (First produces `mymodule.cppm`, second produces `mymodule.o`.)
```bash
clang++ -std=c++20 mymodule.cppm --precompile
clang++ -fmodule-file=mymodule.pcm -std=c++20 mymodule.cpp -c
```
Clang will always load module files specified via `-fmodule-file` when omitting the name. So it makes sense that this works.

However, trying to load the module conditionally by declaring the modulename fails:
```bash
clang++ -fmodule-file=mymodule=mymodule.pcm -std=c++20 mymodule.cpp -c
# error: definition of module 'mymodule' is not available; use -fmodule-file= to specify path to precompiled module interface
```
It seems like module name resolution does not work in this case.

Shouldn't clang autodetect the correct module interface just from its name in the `-fmodule-file` flag?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to