jeremy-rifkin / libassert

The most over-engineered C++ assertion library
MIT License
539 stars 36 forks source link

can not build with gcc 8.5 #95

Closed druidfund closed 5 months ago

druidfund commented 5 months ago

can not build with gcc 8.5:

/opt/vcpkg/buildtrees/libassert/src/v2.0.2-d0c1f55be9.clean/src/tokenizer.cpp: In lambda function:
/opt/vcpkg/buildtrees/libassert/src/v2.0.2-d0c1f55be9.clean/src/tokenizer.cpp:47:10: error: no matching function for call to ‘to_array<std::string_view>(<brace-enclosed initializer list>)’
         });
          ^
In file included from /opt/vcpkg/buildtrees/libassert/src/v2.0.2-d0c1f55be9.clean/src/tokenizer.hpp:8,
                 from /opt/vcpkg/buildtrees/libassert/src/v2.0.2-d0c1f55be9.clean/src/tokenizer.cpp:1:
/opt/vcpkg/buildtrees/libassert/src/v2.0.2-d0c1f55be9.clean/src/utils.hpp:117:50: note: candidate: ‘template<class T, long unsigned int N> constexpr std::array<typename std::remove_cv< <template-parameter-1-1> >::type, N> libassert::detail::to_array(T (&&)[N])’
     constexpr std::array<std::remove_cv_t<T>, N> to_array(T(&&a)[N]) {
                                                  ^~~~~~~~
/opt/vcpkg/buildtrees/libassert/src/v2.0.2-d0c1f55be9.clean/src/utils.hpp:117:50: note:   template argument deduction/substitution failed:
/opt/vcpkg/buildtrees/libassert/src/v2.0.2-d0c1f55be9.clean/src/tokenizer.cpp:47:10: note:   mismatched types ‘std::basic_string_view<char>’ and ‘const char*’
         });
          ^
/opt/vcpkg/buildtrees/libassert/src/v2.0.2-d0c1f55be9.clean/src/tokenizer.cpp:49:16: error: unable to deduce lambda return type from ‘arr’
         return arr;
                ^~~
/opt/vcpkg/buildtrees/libassert/src/v2.0.2-d0c1f55be9.clean/src/tokenizer.cpp: At global scope:
/opt/vcpkg/buildtrees/libassert/src/v2.0.2-d0c1f55be9.clean/src/tokenizer.cpp:50:8: error: class template argument deduction failed:
     } ();

is there any suggestion to fix this build error?

jeremy-rifkin commented 5 months ago

Hi, gcc 8 is pretty old. I'm guessing it doesn't support some of the c++17 features that part of the code relies on. The quickest workaround would be to update to gcc 9 or newer https://godbolt.org/z/vEeoaE9Wo, but I'll look to see if there's any way to make this work in gcc 8.

druidfund commented 5 months ago

Hi, gcc 8 is pretty old. I'm guessing it doesn't support some of the c++17 features that part of the code relies on. The quickest workaround would be to update to gcc 9 or newer https://godbolt.org/z/vEeoaE9Wo, but I'll look to see if there's any way to make this work in gcc 8.

for some reason, i can not upgrade gcc, looking forward progress on workaround in gcc8, thanks a lot

jeremy-rifkin commented 5 months ago

It turns out it was just one part of the code that gcc 8 struggled with so I went ahead and changed it. Gcc 8 is now supported on dev, however, since it's so old I can't promise it will stay supported in future versions and I would still recommend upgrading gcc.