[llvm-bugs] [Bug 51910] New: Undefined symbol when using iostream in module interface unit
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Sep 20 00:25:21 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51910
Bug ID: 51910
Summary: Undefined symbol when using iostream in module
interface unit
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++2a
Assignee: unassignedclangbugs at nondot.org
Reporter: is7e9jnxv at protonmail.com
CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk
Created attachment 25273
--> https://bugs.llvm.org/attachment.cgi?id=25273&action=edit
test case
On x86-64 Ubuntu 21.04, when I use cout and endl together in a function defined
in a module interface unit, the linker (both ld and lld) reports that that
function is not defined, but only when there is also a corresponding module
implementation unit. Reference the following compile commands with the attached
file containing the text of the three source files clangbug.cpp, clangbug.cppm,
and main.cpp. Removing endl from the line causing the linker failure (line 2 of
somethingElse()) also resolves the issue. Omitting -flto does not affect the
outcome.
clang++ -fmodules -std=c++20 -stdlib=libc++ -Wall -Wextra -Wpedantic -O3 -flto
--precompile -o clangbug.pcm clangbug.cppm
clang++ -fmodules -std=c++20 -stdlib=libc++ -Wall -Wextra -Wpedantic -O3 -flto
clangbug.pcm clangbug.cpp -fmodule-file=clangbug.pcm -c
clang++ --ld-path=ld.lld -fmodules -std=c++20 -stdlib=libc++ -Wall -Wextra
-Wpedantic -O3 -flto -o clangbugTest clangbug.o main.cpp
-fmodule-file=clangbug.pcm
ld.lld: error: undefined symbol: _ZW8clangbugE13somethingElsev
>>> referenced by ld-temp.o
>>> lto.tmp:(main)
clang-14: error: linker command failed with exit code 1 (use -v to see
invocation)
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210920/5512cb1a/attachment.html>
More information about the llvm-bugs
mailing list