https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113884

--- Comment #7 from Jason Liam <jlame646 at gmail dot com> ---
(In reply to Andrew Pinski from comment #5)
> std::vector 's constructor which takes std::size_t is marked as explicit.

But you're missing that the initializer list ctor is preferred/choosen over the
size_t arg ctor. 

See
https://stackoverflow.com/questions/27144054/why-is-the-stdinitializer-list-constructor-preferred-when-using-a-braced-initi

I've created the following demo to show this:

```

class Foo
{
    //  val_;
public:
    Foo(std::initializer_list<double> il)
    {
        std::cout << "initializer_list ctor" << std::endl;
    }
     explicit  Foo(std::size_t val)
    {
        std::cout << "ctor" << std::endl;
    };
};

int main()
{
    Foo f = {1.1}; //all compiler use initializer list
}
```

Reply via email to