think-cell / think-cell-library

think-cell core library
https://www.think-cell.com/en/career/devblog/overview
Boost Software License 1.0
415 stars 51 forks source link

Fix the build for Arch Linux / clang++ #22

Closed rzvncj closed 3 years ago

rzvncj commented 4 years ago

With these changes, the code now builds on my Arch Linux machine, with:

$ clang++ -g -O0 -std=c++17 -D_DEBUG range.example.cpp -o range.example

$ clang++ --version
clang version 9.0.1 
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

$ pacman -Qi boost
Name            : boost
Version         : 1.72.0-1
Description     : Free peer-reviewed portable C++ source libraries - development headers
Architecture    : x86_64
URL             : https://www.boost.org/
Licenses        : custom
Groups          : None
Provides        : None
Depends On      : boost-libs=1.72.0
Optional Deps   : python: for python bindings [installed]
                  python2: for python2 bindings [installed]
Required By     : ladish  ros-kinetic-cpp-common  ros-kinetic-rostime
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 175.71 MiB
Packager        : Levente Polyak <anthraxx@archlinux.org>
Build Date      : Mon 27 Jan 2020 10:31:37 PM EET
Install Date    : Thu 30 Jan 2020 07:04:50 PM EET
Install Reason  : Installed as a dependency for another package
Install Script  : No
Validated By    : Signature
treh commented 4 years ago

Hi Răzvan, thanks for the pull request! Where exactly do you get the "no matching function for call to 'explicit_cast'" error? Tobi

rzvncj commented 4 years ago

Hello, here's the error:

$ clang++ -g -O0 -std=c++17 -D_DEBUG range.example.cpp -o range.example
range.example.cpp:22:20: error: no template named 'implicit_cast' in namespace 'boost'; did you mean 'tc::implicit_cast'?
        std::printf("%s", boost::implicit_cast<char const*>(tc::make_c_str<char>(std::forward<Args>(args)...)));
                          ^~~~~~~~~~~~~~~~~~~~
                          tc::implicit_cast
./tc/casts.h:229:23: note: 'tc::implicit_cast' declared here
[[nodiscard]] TTarget implicit_cast(TSource&& src) noexcept
                      ^
range.example.cpp:22:20: error: no template named 'implicit_cast' in namespace 'boost'; did you mean 'tc::implicit_cast'?
        std::printf("%s", boost::implicit_cast<char const*>(tc::make_c_str<char>(std::forward<Args>(args)...)));
                          ^~~~~~~~~~~~~~~~~~~~
                          tc::implicit_cast
./tc/casts.h:229:23: note: 'tc::implicit_cast' declared here
[[nodiscard]] TTarget implicit_cast(TSource&& src) noexcept
                      ^
2 errors generated.
rzvncj commented 4 years ago

Gah! Sorry, it was implicit_cast. I'll redo the commit message later tonight when I get back from work. Although I remember quite clearly copy-pasting that error message from somewhere, so it's probably been fixed by another patch.

rzvncj commented 4 years ago

I've updated the commit text, sorry for the mix-up. If there's anything else you'd like changed in the pull request please let me know.

rzvncj commented 4 years ago

Right, mystery solved. I've done the work on a couple of machines (Arch Linux and an older Ubuntu), and the Ubuntu machine has clang 6.0.0 and Boost 1.65.1, and I get this:

In file included from range.example.cpp:9:
In file included from ./tc/range.h:33:
In file included from ./tc/algorithm.h:18:
In file included from ./tc/partition_iterator.h:13:
In file included from ./tc/static_vector.h:17:
./tc/append.h:305:10: error: no matching function for call to 'explicit_cast'
                return tc::explicit_cast<std::basic_string<Char>>(std::forward<Rng>(rng)...);
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./tc/make_c_str.h:71:79: note: in instantiation of function template specialization 'tc::make_str<char, tc::no_adl::integral_as_padded_dec_impl<int, 1>, char const (&)[3]>' requested here
                return tc::no_adl::make_c_str_impl<Char const, std::basic_string<Char>>(tc::make_str<Char>(std::forward<Rng0>(rng0), std::forward<Rng>(rng)...));
                                                                                            ^
range.example.cpp:22:58: note: in instantiation of function template specialization 'tc::make_c_str<char, tc::no_adl::integral_as_padded_dec_impl<int, 1>, char const (&)[3]>' requested here
        std::printf("%s", boost::implicit_cast<char const*>(tc::make_c_str<char>(std::forward<Args>(args)...)));
                                                                ^
range.example.cpp:32:4: note: in instantiation of function template specialization '(anonymous namespace)::print<tc::no_adl::integral_as_padded_dec_impl<int, 1>, char const (&)[3]>' requested here
                        print(tc::as_dec(n), ", ");
                        ^
./tc/explicit_cast.h:177:31: note: candidate template ignored: substitution failure [with TTarget = std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, Args = <tc::no_adl::integral_as_padded_dec_impl<int, 1>, char const (&)[3]>, $2 = nullptr]: no matching function for call to 'InternalConvert'
        [[nodiscard]] constexpr auto explicit_cast(Args&&... args)
                                     ^
./tc/explicit_cast.h:181:31: note: candidate template ignored: requirement 'tc::is_safely_constructible<std::remove_cv_t<basic_string<char, char_traits<char>, allocator<char> > >, integral_as_padded_dec_impl<int, 1> &&, char const (&&)[3]>::value' was not satisfied [with TTarget = std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, Args = <tc::no_adl::integral_as_padded_dec_impl<int, 1>, char const (&)[3]>]
        [[nodiscard]] constexpr auto explicit_cast(Args&&... args)
                                     ^
./tc/explicit_cast.h:215:18: note: candidate function template not viable: requires 1 argument, but 2 were provided
        DEFINE_FN_TMPL( explicit_cast, (typename) );

IIRC the respective patch fixes this as well, but it's indeed much better to reference the more modern error message in the commit description.

treh commented 4 years ago

Hi Răzvan, we updated the code to work with the newest boost version and solved a few things a little differently. Could you check if it works for you with the latest update and otherwise let us know?

rzvncj commented 4 years ago

Hey Tobi,

Still no go:

$ clang++ -g -O0 -std=c++17 -D_DEBUG range.example.cpp -o range.example
In file included from range.example.cpp:9:
In file included from ./tc/range.h:24:
In file included from ./tc/meta.h:12:
In file included from ./tc/range_fwd.h:11:
In file included from ./tc/bool_cast.h:10:
./tc/type_traits.h:186:45: error: no member named 'basic_string' in namespace 'std'
                struct is_class_safely_constructible<std::basic_string<C,T,A>, tc::type::list<Arg0, Args...>> final
                                                     ~~~~~^
./tc/type_traits.h:186:58: error: 'C' does not refer to a value
                struct is_class_safely_constructible<std::basic_string<C,T,A>, tc::type::list<Arg0, Args...>> final
                                                                       ^
./tc/type_traits.h:185:22: note: declared here
                template <typename C, typename T, typename A, typename Arg0, typename... Args>
                                   ^
./tc/type_traits.h:186:76: error: no variable template matches partial specialization
                struct is_class_safely_constructible<std::basic_string<C,T,A>, tc::type::list<Arg0, Args...>> final
                                                                                         ^
./tc/type_traits.h:186:96: error: expected ';' at end of declaration
                struct is_class_safely_constructible<std::basic_string<C,T,A>, tc::type::list<Arg0, Args...>> final
                                                                                                             ^
                                                                                                             ;
./tc/type_traits.h:186:95: error: expected unqualified-id
                struct is_class_safely_constructible<std::basic_string<C,T,A>, tc::type::list<Arg0, Args...>> final
                                                                                                            ^
5 errors generated.

This is the master branch (freshly cloned).

Quuxplusone commented 4 years ago

Here's a reduced test case, using Boost 1.67 and clang version 11.0.0 (git@github.com:llvm/llvm-project 38a8760b99b7036ce5133574007a7ab7e5ea9d9c) and this repo commit dde90fdc74765098fa7bdcafdb3b0ea51fe5254a.

#include "tc/format.h"
#include "tc/make_c_str.h"

void basic () {
    tc::make_c_str<char>(tc::as_dec(42));
}
$ clang++ -std=c++2a test.cpp -I /usr/local/Cellar/boost/1.67.0_1/include -c
In file included from test.cpp:1:
./tc/format.h:59:12: error: no matching function for call to 'for_each'
                                return tc::for_each(tc::ptr_begin( boost::lexical_cast< std::array<tc::sink_value_or_char_t<Sink>,50> >(m_n+0/*force i...
                                       ^~~~~~~~~~~~
./tc/for_each.h:146:26: note: in instantiation of function template specialization 'tc::no_adl::integral_as_padded_dec_impl<int,
      1>::operator()<tc::append_no_adl::appender_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >' requested
      here
                        std::is_void<decltype(std::declval<Rng>()(std::declval<Func>()))>::value ||
                                              ^
[...]

In file included from test.cpp:2:
In file included from ./tc/make_c_str.h:13:
./tc/append.h:305:10: error: no matching function for call to 'explicit_cast'
                return tc::explicit_cast<std::basic_string<Char>>(std::forward<Rng>(rng)...);
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./tc/make_c_str.h:71:79: note: in instantiation of function template specialization 'tc::make_str<char, tc::no_adl::integral_as_padded_dec_impl<int, 1> >'
      requested here
                return tc::no_adl::make_c_str_impl<Char const, std::basic_string<Char>>(tc::make_str<Char>(std::forward<Rng0>(rng0), std::forward<Rng>...
                                                                                            ^
test.cpp:5:9: note: in instantiation of function template specialization 'tc::make_c_str<char, tc::no_adl::integral_as_padded_dec_impl<int, 1>>'
      requested here
    tc::make_c_str<char>(tc::as_dec(42));
        ^
./tc/explicit_cast.h:218:18: note: candidate function template not viable: no known conversion from 'tc::no_adl::integral_as_padded_dec_impl<int, 1>' to
      'no_adl::define_fn_dummy_t' for 1st argument
        DEFINE_FN_TMPL( explicit_cast, (typename) );
                        ^
./tc/functors.h:105:31: note: expanded from macro 'DEFINE_FN_TMPL'
        [[maybe_unused]] static void func(define_fn_dummy_t) noexcept; \
                                     ^
./tc/explicit_cast.h:180:31: note: candidate template ignored: substitution failure [with TTarget = std::__1::basic_string<char, std::__1::char_traits<char>,
      std::__1::allocator<char> >, Args = <tc::no_adl::integral_as_padded_dec_impl<int, 1>>, $2 = nullptr]: no matching function for call to 'InternalConvert'
        [[nodiscard]] constexpr auto explicit_cast(Args&&... args)
                                     ^
./tc/explicit_cast.h:184:31: note: candidate template ignored: requirement 'tc::is_safely_constructible<std::__1::basic_string<char,
      std::__1::char_traits<char>, std::__1::allocator<char> >, tc::no_adl::integral_as_padded_dec_impl<int, 1> &&>::value' was not satisfied [with TTarget =
      std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, Args = <tc::no_adl::integral_as_padded_dec_impl<int, 1>>]
        [[nodiscard]] constexpr auto explicit_cast(Args&&... args)
                                     ^
treh commented 3 years ago

Hi Răzvan, I updated the repository and this time tested with the examples and your repro on a current linux machine (Ubuntu 20.10, clang++ 11.0.0-2 , both libc++ and libstdc++, boost 1.71).

rzvncj commented 3 years ago

Still doesn't work at all for me on Arch Linux. However, it is not important to me at this point whether this compiles on my machine or not, so if you continue to prefer to not use this PR it's fine to close it if you want.

$ clang++ --version
clang version 11.1.0
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

$ clang++ -g -O0 -std=c++17 -D_DEBUG range.example.cpp -o range.example
In file included from range.example.cpp:9:
In file included from ./tc/range.h:32:
In file included from ./tc/algorithm.h:18:
In file included from ./tc/partition_iterator.h:13:
In file included from ./tc/static_vector.h:17:
./tc/append.h:148:4: warning: use of this statement in a constexpr function is a C++20 extension [-Wc++20-extensions]
                        try {
                        ^
In file included from range.example.cpp:9:
In file included from ./tc/range.h:32:
In file included from ./tc/algorithm.h:27:
In file included from ./tc/for_each_xxx.h:12:
./tc/array.h:408:22: error: expected ')'
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                          ^
./tc/functors.h:157:159: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                                                                                                              ^
./tc/array.h:408:28: note: to match this '('
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                                ^
./tc/array.h:408:22: error: expected ')'
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                          ^
./tc/functors.h:157:159: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                                                                                                              ^
./tc/array.h:408:28: note: to match this '('
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                                ^
./tc/array.h:408:22: error: declaration type contains unexpanded parameter pack 'args'
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~
./tc/functors.h:157:55: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                      ^                                                                                           ~~~~   ~~~~
In file included from range.example.cpp:9:
In file included from ./tc/range.h:32:
In file included from ./tc/algorithm.h:27:
In file included from ./tc/for_each_xxx.h:12:
./tc/array.h:408:22: error: expected ')'
./tc/functors.h:157:159: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                                                                                                              ^
./tc/array.h:408:28: note: to match this '('
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                                ^
./tc/array.h:408:22: error: expression contains unexpanded parameter pack 'args'
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~
./tc/functors.h:157:74: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                         ^                                                                        ~~~~   ~~~~
./tc/return_decltype.h:58:9: note: expanded from macro 'return_decltype_xvalue_by_ref_MAYTHROW'
        return (__VA_ARGS__); \
               ^~~~~~~~~~~~
In file included from range.example.cpp:9:
In file included from ./tc/range.h:32:
In file included from ./tc/algorithm.h:27:
In file included from ./tc/for_each_xxx.h:12:
./tc/array.h:409:22: error: expected ')'
                        tc::for_each(rhs, TC_FN(_ASSERTINITIALIZED));
                                          ^
./tc/functors.h:157:159: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                                                                                                              ^
./tc/array.h:409:28: note: to match this '('
                        tc::for_each(rhs, TC_FN(_ASSERTINITIALIZED));
                                                ^
./tc/array.h:409:22: error: expected ')'
                        tc::for_each(rhs, TC_FN(_ASSERTINITIALIZED));
                                          ^
./tc/functors.h:157:159: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                                                                                                              ^
./tc/array.h:409:28: note: to match this '('
                        tc::for_each(rhs, TC_FN(_ASSERTINITIALIZED));
                                                ^
./tc/array.h:409:22: error: declaration type contains unexpanded parameter pack 'args'
                        tc::for_each(rhs, TC_FN(_ASSERTINITIALIZED));
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~
./tc/functors.h:157:55: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                      ^                                                                                           ~~~~   ~~~~
In file included from range.example.cpp:9:
In file included from ./tc/range.h:32:
In file included from ./tc/algorithm.h:27:
In file included from ./tc/for_each_xxx.h:12:
./tc/array.h:409:22: error: expected ')'
./tc/functors.h:157:159: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                                                                                                              ^
./tc/array.h:409:28: note: to match this '('
                        tc::for_each(rhs, TC_FN(_ASSERTINITIALIZED));
                                                ^
./tc/array.h:409:22: error: expression contains unexpanded parameter pack 'args'
                        tc::for_each(rhs, TC_FN(_ASSERTINITIALIZED));
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~
./tc/functors.h:157:74: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                         ^                                                                        ~~~~   ~~~~
./tc/return_decltype.h:58:9: note: expanded from macro 'return_decltype_xvalue_by_ref_MAYTHROW'
        return (__VA_ARGS__); \
               ^~~~~~~~~~~~
In file included from range.example.cpp:9:
In file included from ./tc/range.h:32:
In file included from ./tc/algorithm.h:27:
In file included from ./tc/for_each_xxx.h:12:
./tc/array.h:417:22: error: expected ')'
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                          ^
./tc/functors.h:157:159: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                                                                                                              ^
./tc/array.h:417:28: note: to match this '('
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                                ^
./tc/array.h:417:22: error: expected ')'
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                          ^
./tc/functors.h:157:159: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                                                                                                              ^
./tc/array.h:417:28: note: to match this '('
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                                ^
./tc/array.h:417:22: error: declaration type contains unexpanded parameter pack 'args'
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~
./tc/functors.h:157:55: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                      ^                                                                                           ~~~~   ~~~~
In file included from range.example.cpp:9:
In file included from ./tc/range.h:32:
In file included from ./tc/algorithm.h:27:
In file included from ./tc/for_each_xxx.h:12:
./tc/array.h:417:22: error: expected ')'
./tc/functors.h:157:159: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                                                                                                              ^
./tc/array.h:417:28: note: to match this '('
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                                ^
./tc/array.h:417:22: error: expression contains unexpanded parameter pack 'args'
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~
./tc/functors.h:157:74: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                         ^                                                                        ~~~~   ~~~~
./tc/return_decltype.h:58:9: note: expanded from macro 'return_decltype_xvalue_by_ref_MAYTHROW'
        return (__VA_ARGS__); \
               ^~~~~~~~~~~~
In file included from range.example.cpp:9:
In file included from ./tc/range.h:32:
In file included from ./tc/algorithm.h:27:
In file included from ./tc/for_each_xxx.h:12:
./tc/array.h:418:22: error: expected ')'
                        tc::for_each(rhs, TC_FN(_ASSERTINITIALIZED));
                                          ^
./tc/functors.h:157:159: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                                                                                                              ^
./tc/array.h:418:28: note: to match this '('
                        tc::for_each(rhs, TC_FN(_ASSERTINITIALIZED));
                                                ^
./tc/array.h:418:22: error: expected ')'
                        tc::for_each(rhs, TC_FN(_ASSERTINITIALIZED));
                                          ^
./tc/functors.h:157:159: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                                                                                                              ^
./tc/array.h:418:28: note: to match this '('
                        tc::for_each(rhs, TC_FN(_ASSERTINITIALIZED));
                                                ^
./tc/array.h:418:22: error: declaration type contains unexpanded parameter pack 'args'
                        tc::for_each(rhs, TC_FN(_ASSERTINITIALIZED));
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~
./tc/functors.h:157:55: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                      ^                                                                                           ~~~~   ~~~~
In file included from range.example.cpp:9:
In file included from ./tc/range.h:32:
In file included from ./tc/algorithm.h:27:
In file included from ./tc/for_each_xxx.h:12:
./tc/array.h:418:22: error: expected ')'
./tc/functors.h:157:159: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                                                                                                              ^
./tc/array.h:418:28: note: to match this '('
                        tc::for_each(rhs, TC_FN(_ASSERTINITIALIZED));
                                                ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
treh commented 3 years ago

We already switched to c++2a, would you give it a try with that just out of curiosity?

rzvncj commented 3 years ago

Apologies if this comes off as snarky, I don't mean it that way, but wouldn't you be able to fix this (if you want) by just setting up a virtual machine with Arch Linux (with KVM, Xen, or some VMware product) and do the testing / development there? There's always a chance that the fix won't take if all development and testing is done on a different platform.

Here's the requested test:

$ clang++ -g -O0 -std=c++2a -D_DEBUG range.example.cpp -o range.example
In file included from range.example.cpp:9:
In file included from ./tc/range.h:32:
In file included from ./tc/algorithm.h:27:
In file included from ./tc/for_each_xxx.h:12:
./tc/array.h:408:22: error: expected ')'
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                          ^
./tc/functors.h:157:159: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                                                                                                              ^
./tc/array.h:408:28: note: to match this '('
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                                ^
./tc/array.h:408:22: error: expected ')'
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                          ^
./tc/functors.h:157:159: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                                                                                                              ^
./tc/array.h:408:28: note: to match this '('
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                                ^
./tc/array.h:408:22: error: declaration type contains unexpanded parameter pack 'args'
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~
./tc/functors.h:157:55: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                      ^                                                                                           ~~~~   ~~~~
In file included from range.example.cpp:9:
In file included from ./tc/range.h:32:
In file included from ./tc/algorithm.h:27:
In file included from ./tc/for_each_xxx.h:12:
./tc/array.h:408:22: error: expected ')'
./tc/functors.h:157:159: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                                                                                                              ^
./tc/array.h:408:28: note: to match this '('
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                                ^
./tc/array.h:408:22: error: expression contains unexpanded parameter pack 'args'
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~
./tc/functors.h:157:74: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                         ^                                                                        ~~~~   ~~~~
./tc/return_decltype.h:58:9: note: expanded from macro 'return_decltype_xvalue_by_ref_MAYTHROW'
        return (__VA_ARGS__); \
               ^~~~~~~~~~~~
In file included from range.example.cpp:9:
In file included from ./tc/range.h:32:
In file included from ./tc/algorithm.h:27:
In file included from ./tc/for_each_xxx.h:12:
./tc/array.h:409:22: error: expected ')'
                        tc::for_each(rhs, TC_FN(_ASSERTINITIALIZED));
                                          ^
./tc/functors.h:157:159: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                                                                                                              ^
./tc/array.h:409:28: note: to match this '('
                        tc::for_each(rhs, TC_FN(_ASSERTINITIALIZED));
                                                ^
./tc/array.h:409:22: error: expected ')'
                        tc::for_each(rhs, TC_FN(_ASSERTINITIALIZED));
                                          ^
./tc/functors.h:157:159: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                                                                                                              ^
./tc/array.h:409:28: note: to match this '('
                        tc::for_each(rhs, TC_FN(_ASSERTINITIALIZED));
                                                ^
./tc/array.h:409:22: error: declaration type contains unexpanded parameter pack 'args'
                        tc::for_each(rhs, TC_FN(_ASSERTINITIALIZED));
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~
./tc/functors.h:157:55: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                      ^                                                                                           ~~~~   ~~~~
In file included from range.example.cpp:9:
In file included from ./tc/range.h:32:
In file included from ./tc/algorithm.h:27:
In file included from ./tc/for_each_xxx.h:12:
./tc/array.h:409:22: error: expected ')'
./tc/functors.h:157:159: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                                                                                                              ^
./tc/array.h:409:28: note: to match this '('
                        tc::for_each(rhs, TC_FN(_ASSERTINITIALIZED));
                                                ^
./tc/array.h:409:22: error: expression contains unexpanded parameter pack 'args'
                        tc::for_each(rhs, TC_FN(_ASSERTINITIALIZED));
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~
./tc/functors.h:157:74: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                         ^                                                                        ~~~~   ~~~~
./tc/return_decltype.h:58:9: note: expanded from macro 'return_decltype_xvalue_by_ref_MAYTHROW'
        return (__VA_ARGS__); \
               ^~~~~~~~~~~~
In file included from range.example.cpp:9:
In file included from ./tc/range.h:32:
In file included from ./tc/algorithm.h:27:
In file included from ./tc/for_each_xxx.h:12:
./tc/array.h:417:22: error: expected ')'
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                          ^
./tc/functors.h:157:159: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                                                                                                              ^
./tc/array.h:417:28: note: to match this '('
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                                ^
./tc/array.h:417:22: error: expected ')'
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                          ^
./tc/functors.h:157:159: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                                                                                                              ^
./tc/array.h:417:28: note: to match this '('
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                                ^
./tc/array.h:417:22: error: declaration type contains unexpanded parameter pack 'args'
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~
./tc/functors.h:157:55: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                      ^                                                                                           ~~~~   ~~~~
In file included from range.example.cpp:9:
In file included from ./tc/range.h:32:
In file included from ./tc/algorithm.h:27:
In file included from ./tc/for_each_xxx.h:12:
./tc/array.h:417:22: error: expected ')'
./tc/functors.h:157:159: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                                                                                                              ^
./tc/array.h:417:28: note: to match this '('
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                                ^
./tc/array.h:417:22: error: expression contains unexpanded parameter pack 'args'
                        tc::for_each(lhs, TC_FN(_ASSERTINITIALIZED));
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~
./tc/functors.h:157:74: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                         ^                                                                        ~~~~   ~~~~
./tc/return_decltype.h:58:9: note: expanded from macro 'return_decltype_xvalue_by_ref_MAYTHROW'
        return (__VA_ARGS__); \
               ^~~~~~~~~~~~
In file included from range.example.cpp:9:
In file included from ./tc/range.h:32:
In file included from ./tc/algorithm.h:27:
In file included from ./tc/for_each_xxx.h:12:
./tc/array.h:418:22: error: expected ')'
                        tc::for_each(rhs, TC_FN(_ASSERTINITIALIZED));
                                          ^
./tc/functors.h:157:159: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                                                                                                              ^
./tc/array.h:418:28: note: to match this '('
                        tc::for_each(rhs, TC_FN(_ASSERTINITIALIZED));
                                                ^
./tc/array.h:418:22: error: expected ')'
                        tc::for_each(rhs, TC_FN(_ASSERTINITIALIZED));
                                          ^
./tc/functors.h:157:159: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                                                                                                              ^
./tc/array.h:418:28: note: to match this '('
                        tc::for_each(rhs, TC_FN(_ASSERTINITIALIZED));
                                                ^
./tc/array.h:418:22: error: declaration type contains unexpanded parameter pack 'args'
                        tc::for_each(rhs, TC_FN(_ASSERTINITIALIZED));
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~
./tc/functors.h:157:55: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                      ^                                                                                           ~~~~   ~~~~
In file included from range.example.cpp:9:
In file included from ./tc/range.h:32:
In file included from ./tc/algorithm.h:27:
In file included from ./tc/for_each_xxx.h:12:
./tc/array.h:418:22: error: expected ')'
./tc/functors.h:157:159: note: expanded from macro 'TC_FN'
#define TC_FN(...) tc::mem_fn_adl::wrap_xvalue_by_ref{[](auto&&... args) return_decltype_xvalue_by_ref_MAYTHROW(__VA_ARGS__(std::forward<decltype(args)>(args)...))}
                                                                                                                                                              ^
./tc/array.h:418:28: note: to match this '('
                        tc::for_each(rhs, TC_FN(_ASSERTINITIALIZED));
                                                ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
rzvncj commented 3 years ago

Closing the PR, appears to be low priority for both owner and me.

treh commented 3 years ago

Actually, we reproduced your error and I just pushed a commit that should fix it.

rzvncj commented 3 years ago

Ah, sorry for prematurely closing the PR then. Tested and confirmed. Thanks!