[cfe-dev] Looks lie a bug: no implicit conversion from slice_array to valarray in 3.4.1 + libcpp
Marshall Clow
mclow.lists at gmail.com
Mon Sep 15 16:12:38 PDT 2014
On Sep 15, 2014, at 9:48 AM, Lev Serebryakov <lev at FreeBSD.org> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
>
> On 15.09.2014 20:38, Marshall Clow wrote:
>
>>> 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 opened issue http://llvm.org/bugs/show_bug.cgi?id=20946 to
>> track this.
>>
>> I’m not sure if this is a bug in libc++, or an extension in
>> libstdc++. A quick look at the standard doesn’t show any implicit
>> conversions from a single-element slice array (the result of
>> 'b[std::slice(1,1,1)]’) to a double.
>>
>> Thanks for the report.
> I could be wrong (I'm not C++ guru), but looks like
> slice_array<double> should be converted to valarray<double> in such
> case with appropriate valarray's constructor (it isn't marked as
> "explicit"), because there are appropriate "operator *=" in valarray
> class to multiple two valarrays.
Yes, that seems to be the case.
You’re welcome to add yourself to the bug, and then you’ll get notifications
as it is updated.
> I want to note, that in real code I encounter this, slice was not
> single-element, and it worked in gcc 4.8. Maybe, my trimmed example is
> not very good (due to single-element slice, which could lead to
> confusion).
>
Right. Noted.
Thanks again.
— Marshall
> - --
> // Lev Serebryakov
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.22 (MingW32)
>
> iQJ8BAEBCgBmBQJUFxhhXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
> ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRGOTZEMUNBMEI1RjQzMThCNjc0QjMzMEFF
> QUIwM0M1OEJGREM0NzhGAAoJEOqwPFi/3EePc1QP/R6Df7HNVBHbjbUHkbsmwma0
> R3fQvqYVbjL2956UmSk6MyJW4NxNTk7wfdkYL/ajJT5/3xI2VWLfV0drhCnkLSrF
> lUIyLv7lktYKQY5UysDaQlqIlfMJEaOYvn9/21SVrSizOJUwD3iwJN/jeyemDLRn
> 8ZEIVPvR/bMnw/XoW7etI/jMkSuo+fVgtAPFCj0kAYjfm6g0aCfp94EUDy1Ovr/k
> LRB+0BKvAoHCg3GJs7crP0iWsIiE4NliNueJF16LS5jtutCG1wZJ3KtOhAfXi7Mp
> /O4fokrPFwNrXTggiroRzcSy0hbSUclaIiPofzClcScSlwD5QcznFu/pNNO5BwcR
> x+pumt+ctRGpkJ9UB808L5MSbuMeQ5bbhm9A88KP7LEWaAvwiDxVZ6JfMgScV8cn
> B8x8jOgb4XOIc7yABQujPNu6W2oC8Ii5G4NUPgDwNx/8u992e1vg5K9nLxf5B98D
> f6OoBNG9V0thQJPqeVUDSHIpjg0M7OP/2DsEgnrZ8yDx9VadDmtX+6rMFp54oS02
> KfodseZHi63oAt+YDlBf/p0xgA4sr0Ya5YKVRB7IXd7nD1xvI7nlfCAZS/j1egH2
> k/Rti+vozklZUD/J2ang48UM1hw/toti6k7J7ltjYE8gO+ZyXIxD0qkjJ+SsePTG
> fRjOI/wzftkbs1WuAg+Z
> =ctrD
> -----END PGP SIGNATURE-----
More information about the cfe-dev
mailing list