[Bug c++/52522] Overloaded functions called with initializer lists considered ambiguous

daniel.kruegler at googlemail dot com gcc-bugzilla@gcc.gnu.org
Thu Mar 8 18:35:00 GMT 2012


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.



More information about the Gcc-bugs mailing list