[Bug libstdc++/13121] Inserting struct with valarray in map fails

Uwe dot Seimet at seimet dot de gcc-bugzilla@gcc.gnu.org
Wed Nov 19 15:12:00 GMT 2003


------- Additional Comments From Uwe dot Seimet at seimet dot de  2003-11-19 15:12 -------
Subject: Re:  Inserting struct with valarray in map fails

Hello,

> That might well be that the standard is strange, but that's the way it is
> and I believe it is that way for a good reason.
> 
> In your case it's easy to fix the problem by having an assignment
> operator in your class that first sets the valarray to the right
> size before copying contents.

Yes, indeed. Just another question (or suggestion) on this: Would it be
possible for gcc to not simply ignore such an error condition but to throw
an exception, or assert, or whatever? In our actual (much larger) program,
where we encountered this problem, our program crashed with a floating point
exception in another piece of code. It was quite difficult to find out that
the problem was caused by the valarray assignment. If the gcc runtime had
aborted execution during the assignment it would have been much easier to
identify what was wrong.

Best regards,   Uwe



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13121



More information about the Gcc-bugs mailing list