[Bug c++/61769] const reference value is changed to random by a range-for loop

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jul 10 10:08:00 GMT 2014


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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to theemathas from comment #1)
> I am having some problems with uploading the "main.ii" file (apparently it
> is too big because I #include 3 standard libraries). I am uploading the
> non-preprocessed source code first, and I will upload the preprocessed code
> ASAP.

Don't bother, the program is invalid. std::abs returns a temporary that goes
out of scope at the end of the expression, std::max returns a dangling
reference to that temporary.



More information about the Gcc-bugs mailing list