<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - `operator new(size_t, align_val_t)` doesn't work in a module"
href="https://bugs.llvm.org/show_bug.cgi?id=41364">41364</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>`operator new(size_t, align_val_t)` doesn't work in a module
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>8.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Modules
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>blckcat@inbox.ru
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>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.)</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>