[llvm-bugs] [Bug 47235] New: Overloaded template functions became ambiguous
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Aug 19 06:53:40 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=47235
Bug ID: 47235
Summary: Overloaded template functions became ambiguous
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: tangyixuan at mail.dlut.edu.cn
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
Clang++ rejects the valid code as ambiguous, while g++ accepts:
$ cat s.C
template<typename T, typename U> void f(U&) { }
template<typename T, typename U> void f(T const&) { }
int main()
{
int a;
f<int, int const>(a);
}
$ clang++ -c s.C
s.C:6:5: error: call to 'f' is ambiguous
f<int, int const>(a);
^~~~~~~~~~~~~~~~~
s.C:1:39: note: candidate function [with T = int, U = const int]
template<typename T, typename U> void f(U&) { }
^
s.C:2:39: note: candidate function [with T = int, U = const int]
template<typename T, typename U> void f(T const&) { }
^
1 error generated.
--
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/20200819/5ef99e98/attachment-0001.html>
More information about the llvm-bugs
mailing list