http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57997
--- Comment #2 from Gabriel Dos Reis <gdr at gcc dot gnu.org> --- (In reply to Paolo Carlini from comment #1) > Gaby, can you help me with this? I think this is typical confusion about what valarray expressions are. f1() has some complicated return type that has essentially reference semantics (as permitted by the standard) and it returns a "morally" reference to the locally constructed temporary. The simplest fix is in the user code: do not assume valarray expressions in general have valarray types.