<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/85561>85561</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Modules crash and/or linker failure
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mmoult
</td>
</tr>
</table>
<pre>
I encountered an issue which I believe to be a bug in clang. The compilation fails during linking, and with some minor modifications to the code, clang crashes. Unfortunately, when I was coming up with the reduced version, I maintained the linker failure but lost the clang crash. Hopefully an investigation into the problem which I kept can fix both. If you can verify that this is a bug (and not a programming mistake on my part), I will take the time to produce the crash report.
I have attached all relevant code files: [files.zip](https://github.com/llvm/llvm-project/files/14626247/files.zip) The issue appears to be coming from the vector parameter of `Foo::noo` (in previous tests, I observed that when the parameter is replaced with a bool or a vector of some other type, the error goes away. Interesting that Bar* is permitted as a return, but not as a specialization of vector.)
The error I am getting looks like this:
```
[10/10] Linking CXX executable modules-test
FAILED: modules-test
: && /home/mmoult/Build/llvm-project-llvmorg-18.1.1/build/bin/clang++ -g CMakeFiles/build.dir/main.cpp.o CMakeFiles/build.dir/foo.cpp.o CMakeFiles/build.dir/bar.cxx.o CMakeFiles/build.dir/foo.cxx.o -o modules-test && :
/usr/bin/ld: CMakeFiles/build.dir/foo.cpp.o: in function `Foo@foo::doo()':
/home/mmoult/git/test/foo.cpp:10: undefined reference to `Foo@foo::num'
/usr/bin/ld: CMakeFiles/build.dir/bar.cxx.o: in function `Bar@bar::call() const':
/home/mmoult/git/test/bar.cxx:12: undefined reference to `Foo@foo::num'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
```
The command I ran on Debian is:
```
cmake -G Ninja -B build -S . -DCMAKE_BUILD_TYPE=Debug
```
The version of CMake I am using is 3.29.0-rc4, found at https://cmake.org/download/ (version 3.29.0-rc3 produced the same error).
The version of Ninja I am using is 1.11.1
The version of clang I am using is:
```
clang version 18.1.1
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/mmoult/Build/llvm-project-llvmorg-18.1.1/build/bin
```
Thanks for your consideration.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVluP27oR_jX0y8CCRPn64If1OmqNJkWBJkD6FFDSSGKWIgVefMmvL4aSnd3tpntOcICF15aGc_nmm28onJOtRtyx5Z4tDzMRfGfsru9NUH5Wmvq6OwLqygTt0WINQoN0LiCcO1l1cIQSlcQTgjdQIggoQwtSQ6WEbhP43CFUph-kEl4aDY2QykEdrNQtKKmfpG4ZfwShazhL34EzPUIvtbHQm1o2sooHHfn30VmNdCD6h8oK16FL4ItujPVBC4_qSu_PHWo4wlk4ik_RwjBGIC8W61BhDSe0ThpNB47QC6m9kBrraEPZoY0ZB4tQBg_KOD9m8TN6An83AzZBqWsER5_QedmO5Uo9pT1YUyrs76g94eChEhoaeYHS-C6BYwNXE-LDE1rZXMF3gsJJB9JNyDK-Iai08SDIaWtFH6vrpfPiCcFo6K8wCOsZ3451naVSEF9SJl72sVmDNYTBWA4VAhYHY33C0gNLH8bPI3TihCC8F1VH3VcKLCo8Ce1jK6CRCh3LH4At9_F78kMObHlgfNN5P9ArxgvGi1b6LpRJZXrGC6VOt3_zwZrvWHnGi9EXL7LFiq_4Yn17FF3ybSTTSD4xDCism0g3Nbixpo_lnLDyxhIIokePFkwDbJUWxlA2-YM2hq1SwlJqGCyepAkOPDrvRsRM6dCeIg-EH6kUm3h3KB2hpQRxKJJKQGmMAmNB3MKbZiSz8R1a8Nch8pb8oLXGQmvQgTiLawLHOFzOUxUx5F5Yxh8ozIC2l94T9sQBiz7YyFfiY6QBPXYDVlIo-WOknWmmJBIiwbN-fr5HP4LooUUfYypjnhwoGSkiY8_GQ6t0-ht_LvdZSv1J2fIAH8fphcevXwEvWAUvSoU0tUGhmxOc47Hi4fjxw4E48vwdTD6JOnzF-AoYLzrTI-PFKD-M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