https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80243
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- Your second example doesn't compile for a very simple reason: (In reply to Jim Michaels from comment #1) > #include <string> > #include <initializer_list> > typedef struct {std::string s;int i;} Structsb; > Structsb fn(std::string s1, int i1) { > return {s1,i1}; > } > int main() {} I'm guessing you didn't mean to put a closing brace here? > Structsb structsb=fn("string",1); > return strustsb.i; > } Do you see what I mean about reporting bugs every time your code doesn't compile? This is a simple mistake, not a bug in GCC. Stop assuming everything is a bug in GCC, which has hundreds of thousands of hours of development and testing by very talented people who understand C++ very well. If something trivial like returning a struct didn't work somebody would have noticed before you did. You're not the only user of GCC.