Skip to content

Commit

Permalink
tuplet: fix bad code generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukester1975 committed Mar 13, 2023
1 parent 65ad53d commit f59731b
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
5 changes: 5 additions & 0 deletions recipes/tuplet/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ sources:
"1.2.2":
url: "https://github.com/codeinred/tuplet/archive/refs/tags/v1.2.2.tar.gz"
sha256: "8605abf16f3ffcf87b0a5d81bc30f75b1fb478a5d747749fca31397e8705f8bc"
patches:
"2.1.0":
- patch_file: "patches/0001-fix-workaround-cl-17.1-fold-expression-issues.patch"
patch_description: "fix bad code generation with VS2022 c++20, tuplet issue #29"
patch_type: "conan"
7 changes: 5 additions & 2 deletions recipes/tuplet/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
from conan.tools.files import copy, get
from conan.tools.files import export_conandata_patches, apply_conandata_patches, copy, get
from conan.tools.layout import basic_layout
from conan.tools.scm import Version
import os
Expand Down Expand Up @@ -41,6 +41,9 @@ def _compilers_minimum_version(self):
"apple-clang": "12"
}

def export_sources(self):
export_conandata_patches(self)

def package_id(self):
self.info.clear()

Expand Down Expand Up @@ -70,7 +73,7 @@ def source(self):
destination=self.source_folder, strip_root=True)

def build(self):
pass
apply_conandata_patches(self)

def package(self):
include_folder = os.path.join(self.source_folder, "include")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
From b8a5bb75e44482eddc9bdfa04c7aed56d6d46b59 Mon Sep 17 00:00:00 2001
From: Luke Elliott <[email protected]>
Date: Sun, 12 Mar 2023 16:55:14 +0000
Subject: [PATCH] fix: workaround cl 17.1 fold expression issues.

#29
---
include/tuplet/tuple.hpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/tuplet/tuple.hpp b/include/tuplet/tuple.hpp
index 749d32a..f385e9f 100644
--- a/include/tuplet/tuple.hpp
+++ b/include/tuplet/tuple.hpp
@@ -895,9 +895,12 @@ namespace tuplet {

template <class U, class... B1, class... B2>
constexpr void _assign_tup(U&& u, type_list<B1...>, type_list<B2...>) {
+ // Not: (void(B1::value = static_cast<U&&>(u).identity_t<B2>::value), ...);
// See:
// https://developercommunity.visualstudio.com/t/fold-expressions-unreliable-in-171-with-c20/1676476
- (void(B1::value = static_cast<U&&>(u).identity_t<B2>::value), ...);
+ // https://github.com/codeinred/tuplet/issues/21
+ // https://github.com/codeinred/tuplet/issues/29
+ (void(B1::value = std::forward<identity_t<B2>>(u).value), ...);
}
template <class U, size_t... I>
constexpr void _assign_index_tup(U&& u, std::index_sequence<I...>) {
--
2.39.2.windows.1

0 comments on commit f59731b

Please sign in to comment.