[Bug c++/84930] Brace-closed initialization of cstring (i.e."abcdefghi") to coresponding aggregate types fails in certain situation

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Nov 19 10:53:00 GMT 2019


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2018-03-28 00:00:00         |2019-11-19

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It doesn't work in a return statement either:

struct array { char data[2]; };

void f(array) {}

array g() {
    f({"a"});
    return {"a"};
}


84930.cc: In function ‘array g()’:
84930.cc:6:12: error: could not convert ‘{"a"}’ from ‘<brace-enclosed
initializer list>’ to ‘array’
     f({"a"});
            ^
84930.cc:7:16: error: could not convert ‘{"a"}’ from ‘<brace-enclosed
initializer list>’ to ‘array’
     return {"a"};
                ^


More information about the Gcc-bugs mailing list