diff --git a/sycl/include/sycl/detail/string.hpp b/sycl/include/sycl/detail/string.hpp index 4c9bf72e025ec..5c09ae34ed33a 100644 --- a/sycl/include/sycl/detail/string.hpp +++ b/sycl/include/sycl/detail/string.hpp @@ -25,7 +25,7 @@ class string { string() noexcept = default; ~string() { delete[] str; } - string(const std::string_view strn) { + string(std::string_view strn) { size_t len = strn.length(); str = new char[len + 1]; strn.copy(str, len); @@ -48,7 +48,7 @@ class string { return *this; } string &operator=(const string &other) { - *this = string{other.str}; + *this = string{other}; return *this; } diff --git a/sycl/include/sycl/detail/string_view.hpp b/sycl/include/sycl/detail/string_view.hpp index 85b526ed31505..c1e52822bbdf5 100644 --- a/sycl/include/sycl/detail/string_view.hpp +++ b/sycl/include/sycl/detail/string_view.hpp @@ -24,7 +24,7 @@ class string_view { public: string_view() noexcept = default; string_view(const string_view &strn) noexcept = default; - string_view(const std::string_view &strn) noexcept : str(strn.data()) {} + string_view(const std::string_view strn) noexcept : str(strn.data()) {} string_view(string_view &&strn) noexcept : str(strn.data()) {} string_view &operator=(string_view &&strn) noexcept { @@ -50,7 +50,6 @@ class string_view { return *this; } - const char *data() noexcept { return str; } const char *data() const noexcept { return str; } friend bool operator==(const string_view &lhs,