This adds a warning about:
auto const v = returns_a_ref();
when the deduced type is a record, and suggests perhaps a missing '&'.
There's usually no need to make a local copy -- unless the reference
is unstable or the object mutated in subsequent code. Adjust to use a
ref, or use constructor notation -- either brace or parens -- to
avoid:
auto const &ref_ok = returns_a_ref(); auto const want_value_1 (returns_a_ref()); auto const want_value_2 {returns_a_ref()};
Found 4 cases in llvm itself (there's a followup patch).
I bottled out of adding this to Wextra or something, but perhaps that'd be a good idea?
Not super happy about "call's lvalue return". How about something along the lines of: initialization of %0 creates a value copy of the returned reference; did you mean '&'?