<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 - Microsoft C++ doesn't consider anonymous namespaces for back-referencing"
href="https://bugs.llvm.org/show_bug.cgi?id=38651">38651</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Microsoft C++ doesn't consider anonymous namespaces for back-referencing
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</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>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>zturner@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, rnk@google.com
</td>
</tr></table>
<p>
<div>
<pre>If you have this code:
// foo.cpp
namespace {
namespace {
int X;
}
}
//
We mangle this as:
?X@?A0xE81D4E31@?A0xE81D4E31@@3HA
while cl mangles this as:
?X@?A0xed6ebf2d@1@3HA
It's fine that the hash values don't match, but it's a bug that we don't store
this hash in the back-reference table. Consider this example instead:
namespace X { namespace X {
namespace { namespace {
namespace Y { namespace Y {
int Z;
} }
} }
} }
Now we mangle this as:
?Z@Y@1?A0xE81D4E31@?A0xE81D4E31@X@2@3HA
And Microsoft's own undname demangles this as:
int A0xE81D4E31::X::`anonymous namespace'::`anonymous namespace'::Y::Y::Z
which is obviously wrong.
This example might seem contrived, but you can make it matter in a more
realistic example too:
//
namespace {
struct X {};
X anonFunc(X x, X y);
template<typename T> void foo(T t);
}
Here, we mangle anonFunc as:
?anonFunc@?A0xE81D4E31@@YA?AUX@?A0xE81D4E31@@U1?A0xE81D4E31@@0@Z
which undname demangles as:
struct `anonymous namespace'::X __cdecl `anonymous namespace'::anonFunc(struct
`anonymous namespace'::A0xE81D4E31,struct `anonymous namespace'::A0xE81D4E31)
(Note both function parameter types are nonsensical).</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>