@@ -1733,6 +1733,87 @@ TEST(FunctionReflectionTest, GetFunctionCallWrapper) {
1733
1733
Cpp::BestOverloadFunctionMatch (operators, {}, {K1, K2});
1734
1734
auto chrono_op_fn_callable = Cpp::MakeFunctionCallable (kop);
1735
1735
EXPECT_EQ (chrono_op_fn_callable.getKind (), Cpp::JitCall::kGenericCall );
1736
+
1737
+ Interp->process (R"(
1738
+ namespace my_std {
1739
+ template <typename T1, typename T2>
1740
+ struct pair {
1741
+ T1 first;
1742
+ T2 second;
1743
+ pair(T1 fst, T2 snd) : first(fst), second(snd) {}
1744
+ };
1745
+
1746
+ template <typename T1, typename T2>
1747
+ pair<T1, T2> make_pair(T1 x, T2 y) {
1748
+ return pair<T1, T2>(x, y);
1749
+ }
1750
+
1751
+ template <int _Int>
1752
+ struct __pair_get;
1753
+
1754
+ template <>
1755
+ struct __pair_get<0> {
1756
+ template <typename T1, typename T2>
1757
+ static constexpr T1 __get(pair<T1, T2> __pair) noexcept {
1758
+ return __pair.first;
1759
+ }
1760
+ };
1761
+
1762
+ template <>
1763
+ struct __pair_get<1> {
1764
+ template <typename T1, typename T2>
1765
+ constexpr T2 __get(pair<T1, T2> __pair) noexcept {
1766
+ return __pair.second;
1767
+ }
1768
+ };
1769
+
1770
+ template <int N, typename T1, typename T2>
1771
+ static constexpr auto get(pair<T1, T2> __t) noexcept {
1772
+ return __pair_get<N>::__get(__t);
1773
+ }
1774
+ } // namespace my_std
1775
+
1776
+ namespace libchemist {
1777
+ namespace type {
1778
+ template <typename T>
1779
+ class tensor {};
1780
+ } // namespace type
1781
+
1782
+ template <typename element_type = double,
1783
+ typename tensor_type = type::tensor<element_type>>
1784
+ class CanonicalMO {};
1785
+
1786
+ template class CanonicalMO<double, type::tensor<double>>;
1787
+
1788
+ auto produce() { return my_std::make_pair(10., type::tensor<double>{}); }
1789
+
1790
+ } // namespace libchemist
1791
+
1792
+ namespace property_types {
1793
+ namespace type {
1794
+ template <typename T>
1795
+ using canonical_mos = libchemist::CanonicalMO<T>;
1796
+ }
1797
+
1798
+ auto produce() { return my_std::make_pair(5., type::canonical_mos<double>{}); }
1799
+ } // namespace property_types
1800
+
1801
+ auto tmp = property_types::produce();
1802
+ auto &p = tmp;
1803
+ )" );
1804
+
1805
+ std::vector<Cpp::TCppFunction_t> unresolved_candidate_methods;
1806
+ Cpp::GetClassTemplatedMethods (" get" , Cpp::GetScope (" my_std" ),
1807
+ unresolved_candidate_methods);
1808
+ Cpp::TCppType_t p = Cpp::GetTypeFromScope (Cpp::GetNamed (" p" ));
1809
+ EXPECT_TRUE (p);
1810
+
1811
+ Cpp::TCppScope_t fn = Cpp::BestOverloadFunctionMatch (
1812
+ unresolved_candidate_methods, {{Cpp::GetType (" int" ), " 0" }}, {p});
1813
+ EXPECT_TRUE (fn);
1814
+
1815
+ auto fn_callable = Cpp::MakeFunctionCallable (fn);
1816
+ EXPECT_EQ (fn_callable.getKind (), Cpp::JitCall::kGenericCall );
1736
1817
}
1737
1818
1738
1819
TEST (FunctionReflectionTest, IsConstMethod) {
0 commit comments