Skip to content

Commit

Permalink
Avoid constexpr use of variant
Browse files Browse the repository at this point in the history
Workaround for placement new causing constexpr variant to explode prior to Clang 19
  • Loading branch information
ZeroMemes committed Sep 30, 2024
1 parent 4f6ccbc commit cd15d3b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
matrix:
compiler:
- { pkg: g++, exe: g++, version: 14 }
# - { pkg: clang, exe: clang++, version: 18 }
- { pkg: clang, exe: clang++, version: 18 }
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 3 additions & 3 deletions src/Scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ namespace hat {

consteval auto count_matches() {
constexpr std::array a{std::byte{1}, std::byte{2}, std::byte{3}, std::byte{4}, std::byte{1}};
constexpr auto s = hat::compile_signature<"01">();
constexpr hat::fixed_signature s{std::byte{1}};

std::vector<const_scan_result> results{};
hat::find_all_pattern(a.cbegin(), a.cend(), std::back_inserter(results), s);
Expand All @@ -110,7 +110,7 @@ namespace hat {

static_assert([] {
constexpr std::array a{std::byte{1}, std::byte{2}, std::byte{3}, std::byte{4}, std::byte{1}};
constexpr auto s = hat::compile_signature<"01">();
constexpr hat::fixed_signature s{std::byte{1}};

std::vector<const_scan_result> results{};
hat::find_all_pattern(a.cbegin(), a.cend(), std::back_inserter(results), s);
Expand All @@ -120,7 +120,7 @@ namespace hat {

static_assert([] {
constexpr std::array a{std::byte{1}, std::byte{2}, std::byte{3}, std::byte{4}, std::byte{1}};
constexpr auto s = hat::compile_signature<"01">();
constexpr hat::fixed_signature s{std::byte{1}};

std::array<const_scan_result, 2> results{};
const auto [scan_end, results_end] = hat::find_all_pattern(a.cbegin(), a.cend(), results.begin(), results.end(), s);
Expand Down

0 comments on commit cd15d3b

Please sign in to comment.