https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104507
Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Summary|[10/11 Regression] internal |[10/11/12 Regression] |compiler error: unexpected |internal compiler error: |expression ‘(int)(__ret)’ |unexpected expression |of kind cast_expr |‘(int)(__ret)’ of kind | |cast_expr Status|UNCONFIRMED |NEW Last reconfirmed| |2022-02-14 Known to fail| |12.0 --- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #3) > (In reply to Daniel Nelson from comment #2) > > Had a few moments to do some testing/bisecting, and found the commit that > > fixed this in mainline. > > I kinda of see how that might help here but not really. I wonder if there is > another testcase which might shows the issue on the trunk still. trunk crashes on this version: #define ERR_MAX -20 #define s_errmsg(r) \ _k_errmsg[(((int)r) <= 0 && r) ? -(r) : -ERR_MAX] extern const char *_k_errmsg[]; template <int size> inline int DoFoo() { int __ret = 0; const char *n = s_errmsg(__ret); return __ret; }