[Bug c++/86997] error: call of overloaded ‘NoDestructor(<brace-enclosed initializer list>)’ is ambiguous
jengelh at inai dot de
gcc-bugzilla@gcc.gnu.org
Fri Nov 9 12:22:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86997
Jan Engelhardt <jengelh at inai dot de> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jengelh at inai dot de
--- Comment #4 from Jan Engelhardt <jengelh at inai dot de> ---
>Is it trying to construct an 'a' object and pass that to the NoDestructor? Or just default construct the NoDestructor object?
As I read it, it's definitely the 1-arg form (always), not the default ctor.
auto a = NoDestructor(); // NoDestructor a;
auto b = NoDestructor{}; // NoDestructor b{};
auto c = NoDestructor({}); // NoDestructor c({});
auto d = NoDestructor{{}}; // NoDestructor d{{}};
The actual chromium code is something like
template<typename T> class NoDestructor { ... }
and is used as
NoDestructor<std::set<std::string>> google_tlds({"foo"});
which means ({}), if it appears, was intended to mean the empty set, and this
empty set is passed as the first and only parameter to the NoDestructor 1-arg
ctor.
More information about the Gcc-bugs
mailing list