https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67795
frankhb1989 at gmail dot com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |UNCONFIRMED Resolution|INVALID |--- --- Comment #2 from frankhb1989 at gmail dot com --- (In reply to Markus Trippelsdorf from comment #1) > gcc even warns: > > t.cpp: In function ‘std::experimental::fundamentals_v1::string_view& > erase_left(size_t, std::experimental::fundamentals_v1::string_view&)’: > t.cpp:9:73: warning: function returns address of local variable > [-Wreturn-local-addr] > return static_cast<string_view &>(n != 0 ? (s.remove_prefix(n), s) : s); > ^ So why it is OK without 'static_cast'? And actually G++ gives me no warnings with -Wall -Wextra -pedantic-errors.