https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67795
--- Comment #9 from frankhb1989 at gmail dot com --- (In reply to Richard Biener from comment #5) > I would guess the issue is that ?: returns an rvalue (but that may not be > 100% correct if omitting the cast works and does not warn) In C++ ?: can return lvalues. I have tried inserting 'static_assert(std::is_same<string_view&, decltype(..)>);' in the function and it does not complain.