[Bug libstdc++/40691] New: bug in logical not operator for valarray used with slice
janis at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Jul 8 20:59:00 GMT 2009
Use of operator! (logical not) from valarray with slice fails. For example,
----------------------------------------------------------------------
#include <valarray>
void test01()
{
const std::valarray<int> vi(12);
std::valarray<bool> vb1(12);
std::valarray<bool> vb2(3);
std::slice s(0,3,4);
vb1 = !vi; // ok
vb2 = !(std::valarray<int>)vi[s]; // ok
vb2 = !vi[s]; // fails
}
----------------------------------------------------------------------
fails with:
elm3b187% /opt/gcc-nightly/trunk/bin/g++ -c valarray-bug.cc
In file included from
/opt/gcc-nightly/trunk-20090706/lib/gcc/powerpc64-linux/4.5.0/../../../../include/c++/4.5.0/valarray:562:0,
from valarray-bug.cc:1:
/opt/gcc-nightly/trunk-20090706/lib/gcc/powerpc64-linux/4.5.0/../../../../include/c++/4.5.0/bits/valarray_after.h:
In member function Âstd::_Expr<std::_UnClos<std::__logical_not, std::_Expr,
_Clos>, bool> std::_Expr<_Clos, _Tp>::operator!() const [with _Clos =
std::_SClos<std::_ValArray, int>, _Tp = int]Â:
valarray-bug.cc:12:14: instantiated from here
/opt/gcc-nightly/trunk-20090706/lib/gcc/powerpc64-linux/4.5.0/../../../../include/c++/4.5.0/bits/valarray_after.h:318:61:
error: conversion from Âstd::_Expr<std::_UnClos<std::__logical_not, std::_Expr,
std::_SClos<std::_ValArray, int> >, int>Â to non-scalar type
Âstd::_Expr<std::_UnClos<std::__logical_not, std::_Expr,
std::_SClos<std::_ValArray, int> >, bool>Â requested
That's std::_Expr<xxx<yyy,int>,int>
to std::_expr<xxx<yyy,int>,bool>
I'm about to submit a proposed patch but would like a PR to keep track of this.
--
Summary: bug in logical not operator for valarray used with slice
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: janis at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40691
More information about the Gcc-bugs
mailing list