<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 - Non-inline unnamed namespaces can be redeclared as inline in some cases"
href="https://bugs.llvm.org/show_bug.cgi?id=42523">42523</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Non-inline unnamed namespaces can be redeclared as inline in some cases
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>maltsevm@gmail.com
</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>The following code is correctly rejected:
inline namespace I {
namespace N {}
using namespace N;
namespace N { int i; }
}
inline namespace N { }
Clang produces the following diagnostic:
<source>:6:18: error: non-inline namespace cannot be reopened as inline
inline namespace N { }
^
<source>:4:15: note: previous definition is here
namespace N { int i; }
^
1 error generated.
Compiler returned: 1
But this code is accepted:
inline namespace I {
namespace { int i; }
}
inline namespace { }
According to the standard ([namespace.unnamed]/1), An
unnamed-namespace-definition behaves as if it were replaced by
inline_opt namespace unique { /* empty body */ }
using namespace unique ;
namespace unique { namespace-body }
where inline appears if and only if it appears in the
unnamed-namespace-definition and all occurrences of unique in a translation
unit are replaced by the same identifier, and this identifier differs from all
other identifiers in the translation unit.
I.e. the second example should also be rejected.</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>