Bug 58706 - testing equality of valarray fails in gcc 2.96-98
testing equality of valarray fails in gcc 2.96-98
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
7.2
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-01-23 10:40 EST by Jeremy Sanders
Modified: 2007-04-18 12:39 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-12-15 14:10:22 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jeremy Sanders 2002-01-23 10:40:23 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.7) Gecko/20011221

Description of problem:
The following code fails to compile with the RedHat 7.2 g++. It works with gcc
3.0 and gcc 2.95.

#include <valarray>

int main()
{
  std::valarray<int> a, b;
  std::valarray<bool> x  = (a==b);

  return 0;
}


Version-Release number of selected component (if applicable):
gcc-c++-2.96-98
gcc-2.96-98
gcc-g77-2.96-98
gcc-objc-2.96-98

How reproducible:
Always

Steps to Reproduce:
1. compile snippet
2.
3.
	

Actual Results:  Get message:

xpc1:~> g++ test.cc
/usr/include/g++-3/std/std_valarray.h: In method 
`valarray<_Tp>::valarray (const _Expr<_Dom, _Tp> &) [with _Dom = 
_BinClos<equal_to, _ValArray, _ValArray, int, int>, _Tp = bool]':
test.cc:6:   instantiated from here
/usr/include/g++-3/std/std_valarray.h:340: no matching function for call to
`__valarray_copy_construct 
(const _Expr<_BinClos<equal_to, _ValArray, _ValArray, int, int>, bool> &, size_t
&, _Array<bool>)'



Additional info:

This code appears to be supported by "The C++ Programming Language", B. Stroustrup.

This code is used in a library I use.
Comment 1 Jeremy Sanders 2002-01-23 11:30:40 EST
Looks like any initialisation of a valarray from a numerical expression doesn't
work.

Try:

  std::valarray<int> x = a*b;
  std::valarray<int> x = a/b;
  std::valarray<int> x = a+b;
...
Comment 2 Alan Cox 2002-12-15 14:10:22 EST
Confirmed ok in 8.0

Note You need to log in before you can comment on or make changes to this bug.