| Issue |
63796
|
| Summary |
[Clang-17][C++20 Modules] Different definitions of same functions in different modules
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
2283572185
|
I use clang-17 with target of x86_64-w64-mingw32 to compile std header units. But I get errors blow.
```
In module 'D:/Tools/gcc/include/c++/14.0.0/random':
D:/Tools/gcc/include/sec_api/stdio_s.h:309:27: error: 'sprintf_s' has different definitions in different modules; definition in module 'D:/Tools/gcc/include/c++/14.0.0/random' first difference is function body
309 | __mingw_ovr int __cdecl sprintf_s(char *_DstBuf, size_t _DstSize, const char *_Format, ...)
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
310 | {
| ~
311 | __builtin_va_list _ArgList;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
312 | int _Ret;
| ~~~~~~~~~
313 | __builtin_va_start(_ArgList, _Format);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
314 | _Ret = _vsprintf_s_l(_DstBuf, _DstSize, _Format, NULL, _ArgList);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
315 | __builtin_va_end(_ArgList);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
316 | return _Ret;
| ~~~~~~~~~~~~
317 | }
| ~
D:/Tools/gcc/include/sec_api/stdio_s.h:309:27: note: but in 'C:\Users\22835\AppData\Local\.xmake\packages\b\benchmark\1.7.0\ef2ea2997db34a0cb9be0597c54ddf80\include/benchmark/benchmark.h' found a different body
309 | __mingw_ovr int __cdecl sprintf_s(char *_DstBuf, size_t _DstSize, const char *_Format, ...)
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
310 | {
| ~
311 | __builtin_va_list _ArgList;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
312 | int _Ret;
| ~~~~~~~~~
313 | __builtin_va_start(_ArgList, _Format);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
314 | _Ret = _vsprintf_s_l(_DstBuf, _DstSize, _Format, NULL, _ArgList);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
315 | __builtin_va_end(_ArgList);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
316 | return _Ret;
| ~~~~~~~~~~~~
317 | }
| ~
In module 'D:/Tools/gcc/include/c++/14.0.0/random':
D:/Tools/gcc/include/sec_api/stdio_s.h:296:27: error: 'vsprintf_s' has different definitions in different modules; definition in module 'D:/Tools/gcc/include/c++/14.0.0/random' first difference is function body
296 | __mingw_ovr int __cdecl vsprintf_s(char *_DstBuf, size_t _Size, const char *_Format, va_list _ArgList)
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
297 | {
| ~
298 | return _vsprintf_s_l(_DstBuf, _Size, _Format, NULL, _ArgList);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
299 | }
| ~
D:/Tools/gcc/include/sec_api/stdio_s.h:296:27: note: but in 'C:\Users\22835\AppData\Local\.xmake\packages\b\benchmark\1.7.0\ef2ea2997db34a0cb9be0597c54ddf80\include/benchmark/benchmark.h' found a different body
296 | __mingw_ovr int __cdecl vsprintf_s(char *_DstBuf, size_t _Size, const char *_Format, va_list _ArgList)
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
297 | {
| ~
298 | return _vsprintf_s_l(_DstBuf, _Size, _Format, NULL, _ArgList);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
299 | }
| ~
9 warnings and 2 errors generated.
```
Use msvc stl will also casue errors like these. The definitions in different modules are same, so it should not cause an error. I can use msvc or gcc to compile the code.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs