[llvm-bugs] [Bug 31450] New: poor diagnostics for ambiguous template function instantation
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Dec 21 13:36:04 PST 2016
https://llvm.org/bugs/show_bug.cgi?id=31450
Bug ID: 31450
Summary: poor diagnostics for ambiguous template function
instantation
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: compnerd at compnerd.org
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Consider the following code:
namespace n {
int f(void *);
template <int> int g(void *);
extern template int g<0>(void *);
}
using namespace n;
template <int> int g(void *p) { return 0; }
template int g<0>(void *);
The template function here is ambiguous because we have n::g and ::g.
We diagnose this as:
$ clang -fsyntax-only -std=c++11 /tmp/reduced.cc
/tmp/reduced.cc:13:14: error: partial ordering for explicit instantiation of
'g' is ambiguous
template int g<0>(void *);
^
/tmp/reduced.cc:11:20: note: explicit instantiation candidate function template
here [with $0 = 0]
template <int> int g(void *p) { return 0; }
^
/tmp/reduced.cc:4:20: note: explicit instantiation candidate function template
here [with $0 = 0]
template <int> int g(void *);
^
While gcc diagnoses this as:
$ c++ -fsyntax-only -std=c++11 /tmp/reduced.cc
/tmp/reduced.cc:13:14: error: ambiguous template specialization 'g<0>' for 'int
g(void*)'
template int g<0>(void *);
^
/tmp/reduced.cc:11:20: note: candidates are: template<int <anonymous> > int
g(void*)
template <int> int g(void *p) { return 0; }
^
/tmp/reduced.cc:4:20: note: template<int <anonymous> > int
n::g(void*)
template <int> int g(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/20161221/bafef3dd/attachment.html>
More information about the llvm-bugs
mailing list