Bug 58706

Summary: testing equality of valarray fails in gcc 2.96-98
Product: [Retired] Red Hat Linux Reporter: Jeremy Sanders <jss>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED CURRENTRELEASE QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-12-15 19:10:22 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jeremy Sanders 2002-01-23 15:40:23 UTC
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 16:30:40 UTC
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 19:10:22 UTC
Confirmed ok in 8.0