<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 - Unhelpful error message on ambiguity due to inline namespaces during template specialization"
href="https://bugs.llvm.org/show_bug.cgi?id=36697">36697</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Unhelpful error message on ambiguity due to inline namespaces during template specialization
</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>All
</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>arthur.j.odwyer@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre><a class="bz_bug_link
bz_status_NEW "
title="NEW - Clang handles ambiguous templates due to 'using' or 'inline namespace' rather horribly"
href="show_bug.cgi?id=10450">Bug 10450</a> is related.
cat >test.cc <<EOF
namespace A {
inline namespace v1 {
template<class T> struct traits { using x = void; };
}
inline namespace v2 {
template<class T> struct traits { using x = void; };
}
}
template<> struct A::traits<int> { using x = int; };
EOF
clang++ -std=c++14 -c test.cc
```
test.cc:10:22: error: explicit specialization of non-template struct 'traits'
template<> struct A::traits<int> { using x = int; };
^ ~~~~~
1 error generated.
```
It would be nicer of Clang to produce a diagnostic specifically highlighting
the ambiguous name lookup of `A::traits` (`A::v1::traits` versus
`A::v2::traits`), rather than claiming that `traits` is a non-template. (There
is no non-template entity `traits` in the test program.)
Ideally the error message would be something like the message you get today for
use (not specialization) of `A::traits`:
```
test.cc:10:23: error: reference to 'traits' is ambiguous
using y = typename A::traits<int>;
^
test.cc:3:34: note: candidate found by name lookup is 'A::v1::traits'
template<class T> struct traits { using x = void; };
^
test.cc:6:34: note: candidate found by name lookup is 'A::v2::traits'
template<class T> struct traits { using x = void; };
^
```</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>