Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot convert initializer list argument to std::slice_array #40138

Closed
yurivict opened this issue Feb 20, 2019 · 2 comments
Closed

cannot convert initializer list argument to std::slice_array #40138

yurivict opened this issue Feb 20, 2019 · 2 comments
Labels
bugzilla Issues migrated from bugzilla libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Comments

@yurivict
Copy link

Bugzilla Link 40792
Version 8.0
OS FreeBSD
CC @DougGregor,@mclow,@zygoloid

Extended Description

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& val_arr).

FreeBSD 11.2

Yuri

---test.cpp---
#include

void f() {
typedef std::valarray 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;
  ^
@llvmbot
Copy link
Collaborator

llvmbot commented Feb 20, 2019

This isn't a clang bug per se, it's a libc++ issue.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
@philnik777
Copy link
Contributor

This has been fixed in LLVM 12: https://godbolt.org/z/ezqrY4dnq.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

No branches or pull requests

3 participants