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

--- Comment #3 from HanatoK <summersnow9403 at gmail dot com> ---
(In reply to Andrew Pinski from comment #2)
> See C++11 and the auto keyword section of
> https://eigen.tuxfamily.org/dox/TopicPitfalls.html
> 
> 
> The problem is that eval() returns a temporary object (in this case a
> MatrixXd) which is then referenced by the Transpose<> expression. However,
> this temporary is deleted right after the first line, and then the C
> expression references a dead object.

Thanks! I can confirm that with the clang sanitizers
"-fsanitize=address,undefined,leak" I encounter the "stack-use-after-scope"
error, so the clang result is actually printed from out-of-scope variables. I
think you are right that I misuse the auto keyword.

Reply via email to