Hacker News new | past | comments | ask | show | jobs | submit login

G++ 5.2 complains: "new types may not be defined in a return type"

An alternative in C++14:

auto hello(int c) { struct { int a; int b; } result { c, c + 1 }; return result; }

or with gcc extensions: auto hello(int c) { return (struct { int a; int b; }) { c, c + 1 }; }




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: