https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95910

--- Comment #2 from Rene Rahn <rene.r...@fu-berlin.de> ---
Ok, thanks for the explanation. I do understand the issue now and why it causes
the hard error and not an substitution failure. 
But honestly, given that it works for container because they are wrapped in a
ref_view with pointer semantics, makes this very hard to understand. And
basically, if you transform something that calls somewhere in the stack a
function with auto return type you might not be able to even do
`decltype(expression)` to get the return type deduced any more, because the
compiler has to instantiate the expression. 

That makes generic code with auto return types kind of difficult to use, does
it? I mean, especially as a library writer I must make sure that the client can
use my methods/types in these contexts. And it feels plausible that types are
constrained to be mutable somewhere in this context.
Is there a general trick to avoid this, except guaranteeing to know the return
type before the expression is evaluated?

Many thanks for your help!

Reply via email to