Skip to content

Commit 5661f0f

Browse files
authored
Merge pull request intel#206 from elbeno/llvm20-fixes
🎨 Small fixes from clang-20
2 parents 7fa1dbc + ddf739e commit 5661f0f

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

include/stdx/env.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ template <typename Q> struct has_query {
3333

3434
template <typename... Envs> struct env {
3535
template <_env::valid_query_over<Envs...> Q>
36-
CONSTEVAL static auto query(Q) noexcept {
36+
[[nodiscard]] CONSTEVAL static auto query(Q) noexcept {
3737
using I = boost::mp11::mp_find_if_q<boost::mp11::mp_list<Envs...>,
3838
_env::has_query<Q>>;
3939
using E = nth_t<I::value, Envs...>;

include/stdx/span.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,12 @@ class span : public detail::span_base<T, Extent> {
111111
"Span extends beyond available storage");
112112
}
113113

114+
// NOLINTNEXTLINE(*-avoid-c-arrays)
115+
template <std::size_t N> using arr_t = type_identity_t<element_type> (&)[N];
116+
114117
template <std::size_t N>
115118
// NOLINTNEXTLINE(google-explicit-constructor)
116-
constexpr span(
117-
// NOLINTNEXTLINE(*-avoid-c-arrays)
118-
stdx::type_identity_t<element_type> (&arr)[N] LIFETIMEBOUND) noexcept
119-
: ptr{std::data(arr)} {
119+
constexpr span(arr_t<N> arr LIFETIMEBOUND) noexcept : ptr{std::data(arr)} {
120120
static_assert(Extent == dynamic_extent or Extent <= N,
121121
"Span extends beyond available storage");
122122
}

include/stdx/type_traits.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ struct call_base {
5454
};
5555

5656
template <typename, bool> struct callable_test : call_base {};
57-
template <typename F> struct callable_test<F, true> : F, call_base {};
57+
template <typename F>
58+
struct callable_test<F, true> : remove_cvref_t<F>, call_base {};
5859

5960
template <typename F, typename = void> constexpr auto is_func_obj = true;
6061
template <typename F>
@@ -144,7 +145,7 @@ struct for_each_t<L<Vs...>> {
144145
(f.template operator()<Vs>(), ...);
145146
}
146147
};
147-
template <template <typename, auto...> typename L, typename T, T... Vs>
148+
template <template <typename X, X...> typename L, typename T, T... Vs>
148149
struct for_each_t<L<T, Vs...>> {
149150
template <typename F> constexpr auto operator()(F &&f) const {
150151
(f.template operator()<Vs>(), ...);
@@ -174,7 +175,7 @@ struct apply_sequence_t<L<Vs...>> {
174175
return f.template operator()<Vs...>();
175176
}
176177
};
177-
template <template <typename, auto...> typename L, typename T, T... Vs>
178+
template <template <typename X, X...> typename L, typename T, T... Vs>
178179
struct apply_sequence_t<L<T, Vs...>> {
179180
template <typename F> constexpr auto operator()(F &&f) const {
180181
return f.template operator()<Vs...>();

test/env.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ namespace {
88
[[maybe_unused]] constexpr inline struct custom_t {
99
template <typename T>
1010
requires true // more constrained
11-
CONSTEVAL auto operator()(T &&t) const
11+
[[nodiscard]] CONSTEVAL auto operator()(T &&t) const
1212
noexcept(noexcept(std::forward<T>(t).query(std::declval<custom_t>())))
1313
-> decltype(std::forward<T>(t).query(*this)) {
1414
return std::forward<T>(t).query(*this);
1515
}
1616

17-
CONSTEVAL auto operator()(auto &&) const { return 42; }
17+
[[nodiscard]] CONSTEVAL auto operator()(auto &&) const { return 42; }
1818
} custom;
1919
} // namespace
2020

0 commit comments

Comments
 (0)