This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]