<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - cannot convert initializer list argument to std::slice_array"
href="https://bugs.llvm.org/show_bug.cgi?id=40792">40792</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>cannot convert initializer list argument to std::slice_array
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>8.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>FreeBSD
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>yuri@tsoft.com
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>The test.c below fails in clang-8, but works with gcc-8.
It is natural that a slice array of equal size is initialized using the
initializer list.
It probably shouldn't fail, and implicitly use this operator: void
std::slice_array::operator=(const std::valarray<T>& val_arr).
FreeBSD 11.2
Yuri
---test.cpp---
#include <valarray>
void f() {
typedef std::valarray<double> matrix;
matrix m;
m[std::slice(2, 3, 3)] = {0.,0.,0.};
}
---message.txt---
valarray-ilist.cpp:6:26: error: no viable overloaded '='
m[std::slice(2, 3, 3)] = {0.,0.,0.};
~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~
/usr/include/c++/v1/valarray:1258:24: note: candidate function not viable:
cannot convert initializer list argument to 'const
std::__1::slice_array<double>'
const slice_array& operator=(const slice_array& __sa) const;
^
/usr/include/c++/v1/valarray:1261:10: note: candidate function not viable:
cannot convert initializer list argument to 'const
std::__1::slice_array<double>::value_type'
(aka 'const double')
void operator=(const value_type& __x) const;
^
/usr/include/c++/v1/valarray:1165:5: note: candidate template ignored: couldn't
infer template argument '_Expr'
operator=(const _Expr& __v) const;
^</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>