[llvm-bugs] [Bug 40792] New: cannot convert initializer list argument to std::slice_array

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 20 11:52:41 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=40792

            Bug ID: 40792
           Summary: cannot convert initializer list argument to
                    std::slice_array
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: yuri at tsoft.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

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;
    ^

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190220/dcf4d580/attachment.html>


More information about the llvm-bugs mailing list