In the attached code the pure attribute is causing the result to be random/junk on the final calculation in main. According to the docs the function seems to qualify for pure status -- it uses only the parameters given. It does however create a temporary (but as this exists on the stack I assumed it is okay, since it still doesn't violate the notion of being pure).
Expected result (with -DNOATTRIB or -DNOCOPYCTOR flags): 5, 5 1, 1 Actual Result (compiled with g++ -o test point_err.cc): 5, 5 338848, 4.85849e-270 (NOTE: Worked on 3.3) It is curious also that no declaring the copy constructor also allows this code to work with the pure attribute. So, either this is a bug in the 4.0 "pure" handling, or the documentation for "pure" is omitting some vital point which my code violates. -- Summary: pure attribute produces incorrect results Product: gcc Version: 4.0.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: eda-qa at disemia dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22597