[Bug libstdc++/37347] New: valarray::operator[](slice) const returns wrong type.
crazydm at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Sep 3 11:23:00 GMT 2008
valarray::operator[](slice) const returns _Expr<_SClos<_ValArray,_Tp>, _Tp>
instead of slice_array<Tp>, this type cannot be casted (with static_cast) to
slice_array<Tp>.
gcc barfs that
"conversion from Âstd::_Expr<std::_SClos<std::_ValArray, double>, double>Â to
non-scalar type Âstd::slice_array<double>Â requested"
This concerns only const version of the operator[](slice), normal version works
fine. So slice_array objects cannot be created using const valarray objects.
P.S. const_cast can be used as a workaround.
The example program is attached.
--
Summary: valarray::operator[](slice) const returns wrong type.
Product: gcc
Version: 4.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: crazydm at gmail dot com
GCC build triplet: Using built-in specs.
GCC host triplet: GNU/Linux alioth 2.6.25-ARCH #1 SMP PREEMP
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37347
More information about the Gcc-bugs
mailing list