[Bug c++/70637] Ambiguity error invoking a constructor with double brace initialization
arthur.j.odwyer at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Feb 5 18:03:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70637
Arthur O'Dwyer <arthur.j.odwyer at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |arthur.j.odwyer at gmail dot com
--- Comment #1 from Arthur O'Dwyer <arthur.j.odwyer at gmail dot com> ---
Confirmed. I ran into the same issue with a unit test that was trying to test
whether a given constructor was `explicit`.
====
// https://godbolt.org/z/STvgby
#include <initializer_list>
struct S {
explicit S();
};
struct T {
T();
};
void foo(S) {}
void foo(T) {}
void bar()
{
foo({});
}
====
GCC says:
<source>: In function 'void bar()':
<source>:16:11: error: call of overloaded 'foo(<brace-enclosed initializer
list>)' is ambiguous
16 | foo({});
| ^
<source>:11:6: note: candidate: 'void foo(S)'
11 | void foo(S) {}
| ^~~
<source>:12:6: note: candidate: 'void foo(T)'
12 | void foo(T) {}
| ^~~
More information about the Gcc-bugs
mailing list