Skip to content

Very strange bug in test_parameter.cpp #173

@evanberkowitz

Description

@evanberkowitz

I'm compiling with

> /usr/bin/clang --version
Apple clang version 16.0.0 (clang-1600.0.26.3)
Target: arm64-apple-darwin23.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

and am getting

[ 98%] Building CXX object Tests/CMakeFiles/test_parameter.dir/Parameter/test_parameter.cpp.o
In file included from /Users/evanberkowitz/physics/hubbard/nsl/Tests/Parameter/test_parameter.cpp:1:
In file included from /Users/evanberkowitz/physics/hubbard/nsl/Tests/Parameter/../test.hpp:5:
In file included from /Users/evanberkowitz/physics/hubbard/nsl/src/NSL/NSL.hpp:11:
/Users/evanberkowitz/physics/hubbard/nsl/src/NSL/typePromotion.hpp:44:33: error: invalid reference to function 'deduce': constraints not satisfied
   44 |     using CommonType = decltype(deduce());
      |                                 ^
/Users/evanberkowitz/physics/hubbard/nsl/src/NSL/typePromotion.hpp:110:1: note: in instantiation of template class 'NSL::TypePromotion<std::string, double>' requested here
  110 | using CommonTypeOf = typename TypePromotion<TypeLeft,TypeRight>::CommonType;
      | ^
/Users/evanberkowitz/physics/hubbard/nsl/src/NSL/Tensor/Impl/operatorMultiplication.tpp:33:25: note: in instantiation of template type alias 'CommonTypeOf' requested here
   33 | inline NSL::Tensor<NSL::CommonTypeOf<ValueType,TensorType>> operator*(const ValueType & value, const NSL::Tensor<TensorType> & tensor) {
      |                         ^
/Users/evanberkowitz/physics/hubbard/nsl/src/NSL/parameter.tpp:125:9: note: while substituting deduced template arguments into function template 'operator*' [with ValueType = std::string, TensorType = double]
  125 |     { t * u } -> std::convertible_to<decltype(t * u)>;
      |         ^
/Users/evanberkowitz/physics/hubbard/nsl/src/NSL/parameter.tpp:125:7: note: in instantiation of requirement here
  125 |     { t * u } -> std::convertible_to<decltype(t * u)>;
      |       ^~~~~
/Users/evanberkowitz/physics/hubbard/nsl/src/NSL/parameter.tpp:124:27: note: while substituting template arguments into constraint expression here
  124 | concept areMultipliable = requires(T t, U u) {
      |                           ^~~~~~~~~~~~~~~~~~~~
  125 |     { t * u } -> std::convertible_to<decltype(t * u)>;
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  126 | };
      | ~
/Users/evanberkowitz/physics/hubbard/nsl/src/NSL/parameter.tpp:603:40: note: (skipping 36 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
  603 |                         if constexpr ( areMultipliable<decltype(lhs_arg),decltype(rhs_arg)> ){
      |                                        ^
/Users/evanberkowitz/physics/hubbard/nsl/src/NSL/parameter.tpp:599:21: note: in instantiation of function template specialization 'std::visit<(lambda at /Users/evanberkowitz/physics/hubbard/nsl/src/NSL/parameter.tpp:600:13), std::variant<bool, int, long long, float, double, c10::complex<float>, c10::complex<double>, std::string, NSL::Tensor<double>, NSL::Tensor<c10::complex<double>>, std::vector<std::vector<double>>, NSL::Device> &, void>' requested here
  599 |         return std::visit(
      |                     ^
/Users/evanberkowitz/physics/hubbard/nsl/Tests/Parameter/test_parameter.cpp:14:52: note: in instantiation of member function 'NSL::GeneralType<bool, int, long long, float, double, c10::complex<float>, c10::complex<double>, std::string, NSL::Tensor<double>, NSL::Tensor<c10::complex<double>>, std::vector<std::vector<double>>, NSL::Device>::operator*' requested here
   14 |     REQUIRE_NOTHROW(params["key4"] = params["key3"]*params["key2"]);
      |                                                    ^
/Users/evanberkowitz/physics/hubbard/nsl/Tests/Parameter/test_parameter.cpp:3:1: note: in instantiation of function template specialization 'C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_2<int>' requested here
    3 | NSL_TEST_CASE("Parameter", "[Parameter]"){
      | ^
/Users/evanberkowitz/physics/hubbard/nsl/Tests/Parameter/../test.hpp:45:31: note: expanded from macro 'NSL_TEST_CASE'
   45 | #define NSL_TEST_CASE(_1, _2) TEMPLATE_TEST_CASE(_1, _2, NSL_TYPES)
      |                               ^

after which it traces back into zillions of lines of catch2 errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions