public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Gabriel Dos Reis <gdr@codesourcery.com>
To: gdr@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org,
Subject: Re: libstdc++/5801: valarray doesn't work as expected with complex types
Date: Mon, 08 Apr 2002 04:46:00 -0000	[thread overview]
Message-ID: <20020408114604.16517.qmail@sources.redhat.com> (raw)

The following reply was made to PR libstdc++/5801; it has been noted by GNATS.

From: Gabriel Dos Reis <gdr@codesourcery.com>
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 <valarray>
 | 
 | typedef std::valarray<int> vint;
 | 
 | int main (void)
 | {
 | 	vint sample(3, 10); //a sample
 
 OK.
 
 | 	std::valarray<vint> x(sample,4); //four of the sample
 
 This is not OK (but I made it work):  std::valarray<T> 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<T> does not obey the abbove rule so you can't say
 std::valarray<std::valarray<T> > and expect a reasonable behaviour.
 
 | 	std::valarray<bool> mask(true, x.size());
 | 	mask[1] = false;
 | 	std::valarray<vint> y(x[mask]); ///< crashes
 
 This is not permitted -- and I didn't have a time to make it work.
 
 -- Gaby


             reply	other threads:[~2002-04-08 11:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-08  4:46 Gabriel Dos Reis [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-04-08  4:48 gdr
2002-03-17 11:39 paolo
2002-03-01  5:46 Andre.dos.Anjos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020408114604.16517.qmail@sources.redhat.com \
    --to=gdr@codesourcery.com \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=gdr@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).