[llvm-bugs] [Bug 36697] New: Unhelpful error message on ambiguity due to inline namespaces during template specialization
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Mar 12 13:26:31 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=36697
Bug ID: 36697
Summary: Unhelpful error message on ambiguity due to inline
namespaces during template specialization
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: arthur.j.odwyer at gmail.com
CC: llvm-bugs at lists.llvm.org
Bug 10450 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; };
^
```
--
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/20180312/2a03083b/attachment.html>
More information about the llvm-bugs
mailing list