<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 - Losing a global const int in clang++"
href="https://bugs.llvm.org/show_bug.cgi?id=44883">44883</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Losing a global const int in clang++
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>felix-llvm@fefe.de
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>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.</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>