[Bug c++/60027] New: Problem with braced-init-lists and explicit ctors
joaquin at tid dot es
gcc-bugzilla@gcc.gnu.org
Sun Feb 2 09:35:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60027
Bug ID: 60027
Summary: Problem with braced-init-lists and explicit ctors
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: joaquin at tid dot es
The following code compiled with -std=c++11:
struct foo
{
foo(int){}
};
struct bar
{
explicit bar(int){}
};
void f(foo){}
void f(bar){}
int main()
{
f({0});
}
yields:
main.cpp:16:8: error: call of overloaded 'f(<brace-enclosed initializer
list>)' is ambiguous
f({0});
^
main.cpp:16:8: note: candidates are:
main.cpp:11:6: note: void f(foo)
void f(foo){}
^
main.cpp:12:6: note: void f(bar)
void f(bar){}
^
which seems incorrect as bar::bar(int) is explicit.
Joaquín M López Muñoz
Telefónica Digital
More information about the Gcc-bugs
mailing list