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

--- Comment #3 from Wolfgang Roehrl <wolfgang.roe...@gi-de.com> ---
Hi Jonathan,

of course you are true. (I was overhasty with my bug report.)

Now I changed my program to using a constexpr-ctor:

#include "atomic"

struct S
{
    explicit constexpr S (bool b = true)
    : m_counter{ b ? 1u : 0u }
    {}

    std::atomic<unsigned short> m_counter;
};

S x;

The compiler rejects this program too - is this correct?

Wolfgang






Von:    "redi at gcc dot gnu.org" <gcc-bugzi...@gcc.gnu.org>
An:     wolfgang.roe...@gi-de.com
Datum:  05.03.2015 11:54
Betreff:        [Bug c++/65322] Narrowing conversion



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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
N.B. to make the code compile just don't use braces for the 
initialization:

    : m_counter( b ? 1u : 0u )

Reply via email to