From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16585 invoked by alias); 8 Apr 2002 11:46:06 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 16527 invoked by uid 71); 8 Apr 2002 11:46:04 -0000 Date: Mon, 08 Apr 2002 04:46:00 -0000 Message-ID: <20020408114604.16517.qmail@sources.redhat.com> To: gdr@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Gabriel Dos Reis Subject: Re: libstdc++/5801: valarray doesn't work as expected with complex types Reply-To: Gabriel Dos Reis X-SW-Source: 2002-04/txt/msg00476.txt.bz2 List-Id: The following reply was made to PR libstdc++/5801; it has been noted by GNATS. From: Gabriel Dos Reis To: Andre.dos.Anjos@cern.ch Cc: gcc-gnats@gcc.gnu.org Subject: Re: libstdc++/5801: valarray doesn't work as expected with complex types Date: 08 Apr 2002 13:45:49 +0200 Andre.dos.Anjos@cern.ch writes: [...] | The following code compiles cleanly, but crashes | **** | #include | | typedef std::valarray vint; | | int main (void) | { | vint sample(3, 10); //a sample OK. | std::valarray x(sample,4); //four of the sample This is not OK (but I made it work): std::valarray works only with some restrictions on T. T must be "friendly", that is there should be no semantic difference between T u(t); and T u; u = t; assuming t is of type T. a std::valarray does not obey the abbove rule so you can't say std::valarray > and expect a reasonable behaviour. | std::valarray mask(true, x.size()); | mask[1] = false; | std::valarray y(x[mask]); ///< crashes This is not permitted -- and I didn't have a time to make it work. -- Gaby