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: unassignedclangb...@nondot.org
          Reporter: jaso...@ca.ibm.com
                CC: dgre...@apple.com, llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to