[cfe-dev] Looks lie a bug: no implicit conversion from slice_array to valarray in 3.4.1 + libcpp
Lev Serebryakov
lev at FreeBSD.org
Fri Sep 12 09:43:40 PDT 2014
Hello, Cfe-dev.
I'm using clang 3.4.1 (FreeBSD-CURRENT system compiler) with
I'm compile very simple program, which uses <valarray>. Of course, it is
test case, I found this bug when try to compile qucs project on this system
============ test.cpp
#include <valarray>
int main(int argc, char *argv[]) {
std::valarray<double> a(4, 10);
std::valarray<double> b(4, 20);
a *= b[std::slice(1,1,1)];
return 0;
}
=====================
I've got this error:
=================================================
test.cpp:6:4: error: no viable overloaded '*='
a *= b[std::slice(1,1,1)];
~ ^ ~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/v1/valarray:871:15: note: candidate function not viable: no known conversion from 'slice_array<value_type>' to 'const value_type'
(aka 'const double') for 1st argument
valarray& operator*= (const value_type& __x);
^
/usr/include/c++/v1/valarray:885:9: note: candidate template ignored: disabled by 'enable_if' [with _Expr = std::__1::slice_array<double>]
__is_val_expr<_Expr>::value,
^
=================================================
Looks like, constructor valarray(const slice_array<double> &) should be
called in this case? I've read
http://en.cppreference.com/w/cpp/language/implicit_cast
and looks like implicit conversion should apply here (second item in first
list)?
gcc 4.8 compiles this code properly.
--
// Black Lion AKA Lev Serebryakov <lev at FreeBSD.org>
More information about the cfe-dev
mailing list