[llvm-bugs] [Bug 25382] New: call of overloaded "function(<brace-enclosed initializer list>)" is ambiguous
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Nov 2 12:05:34 PST 2015
https://llvm.org/bugs/show_bug.cgi?id=25382
Bug ID: 25382
Summary: call of overloaded "function(<brace-enclosed
initializer list>)" is ambiguous
Product: clang
Version: 3.5
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: unassignedclangbugs at nondot.org
Reporter: jasonli at ca.ibm.com
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
Classification: Unclassified
Source:
a.C
#include <initializer_list>
int f(const std::initializer_list<int>&) {return 1;}
int f(const std::initializer_list<const int>&) {return 2;}
int x = f({37});
Found in Clang 3.5 and it's not fixed in Clang 3.7 yet.
clang++ -std=c++11 -c a.C
With g++ 4.8.3:
> g++ -std=c++11 -c a.C
lib_over07.C:4:15: error: call of overloaded "f(<brace-enclosed initializer
list>)" is ambiguous
int x = f({37});
ˆ
But with Clang, it doesn't report an error and choose the non const function to
call.
It's possible to write a test case where this results in doing something wrong
functionally as well, if Clang does not stop user from doing the wrong thing.
--
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/20151102/b3fc8a0d/attachment.html>
More information about the llvm-bugs
mailing list