https://bugs.llvm.org/show_bug.cgi?id=41364
Bug ID: 41364
Summary: `operator new(size_t, align_val_t)` doesn't work in a
module
Product: clang
Version: 8.0
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Modules
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected]
I seem to be unable to use `operator new(size_t, align_val_t)` in modules.
When compiling this module
export module a;
#include <new>
export void *foo() {
return ::operator new(1, std::align_val_t(1));
}
export int main() {}
with -pedantic-errors I get following error:
clang++ -std=c++2a -pedantic-errors -fmodules-ts --precompile -x c++-module
a.cpp -o a.pcm
error: ISO C++ requires a definition in this translation unit for function
'operator new' because its type does not have linkage
[-Werror,-Wundefined-internal-type]
a.cpp:7:14: note: used here
return ::operator new(1, std::align_val_t(1));
Removing -pedantic-errors fixes this error, but I still can't link the module
afterwards:
clang++ -std=c++2a -fmodules-ts a.pcm
.../a-cfaf65.o:a.pcm:(.text+0x10): undefined reference to
`_ZnwyW1aESt11align_val_t'
clang++: error: linker command failed with exit code 1 (use -v to see
invocation)
I'm getting this problem on version 8.0.0 provided by MSYS2 (targeting
x86_64-w64-windows-gnu).
I also tried 9.0.0 (trunk 357358) from gcc.godbolt.org, and was able to
reproduce the first error. (Wasn't able to test the linking on that site.)
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs