This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/52522] Overloaded functions called with initializer lists considered ambiguous
- From: "daniel.kruegler at googlemail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 08 Mar 2012 18:34:36 +0000
- Subject: [Bug c++/52522] Overloaded functions called with initializer lists considered ambiguous
- Auto-submitted: auto-generated
- References: <bug-52522-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52522
--- Comment #5 from Daniel KrÃgler <daniel.kruegler at googlemail dot com> 2012-03-08 18:34:36 UTC ---
(In reply to comment #2)
> but I need to investigate whether this is a language or compiler problem.
It is a language problem. My initial thought that it could be a compiler
problem, is invalid (my thanks to Jason for his help here). The following is
going on here:
The relevant constructors are:
a) template<class InputIter> vector(InputIter, InputIter);
and simplified (i.e. ignoring default arguments):
b) vector(initializer_list<value_type>);
When considering vector<Matrix>, (b) is the clear winner, but when considering
vector<Vector> (b) would not be viable for {a,b}, so the constructor template
(a) is tried in the second phase and matches as well. There is no ordering
between those two cases, therefore the final ambiguity.