[llvm-bugs] [Bug 44883] New: Losing a global const int in clang++
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Feb 12 04:29:08 PST 2020
https://bugs.llvm.org/show_bug.cgi?id=44883
Bug ID: 44883
Summary: Losing a global const int in clang++
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: felix-llvm at fefe.de
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
I'm having a bizarre issue that I suspect is my fault, but I am running out of
ideas on why. Sorry for wasting your time but can you please explain this to
me:
$ cat a.cc
const int foo = 23;
$ cat b.cc
extern const int foo;
int main() { return foo; }
$
First issue:
$ nm b.o
U foo
0000000000000000 T main
$
OK I see why main is not mangled. But foo should be mangled, no?
Doing extern "C++" const int foo does not help, still not mangled.
Second issue:
$ nm a.o
$
Nothing. What happened to foo?
Renaming the files to a.c and b.c makes things work.
Have I missed a C++ memo or two here?
I tried this with GCC too, and g++ will generate a mangled foo symbol in a.o
(_ZL3foo) but it will generate a reference to unmangled foo in b.o. I filed a
bug with them, too.
--
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/20200212/7ab58246/attachment.html>
More information about the llvm-bugs
mailing list