Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

brigand::transform causes GCC and clang to never finish #265

Open
jcelerier opened this issue Nov 18, 2019 · 3 comments
Open

brigand::transform causes GCC and clang to never finish #265

jcelerier opened this issue Nov 18, 2019 · 3 comments

Comments

@jcelerier
Copy link

jcelerier commented Nov 18, 2019

Repro :

#include <brigand/algorithms/transform.hpp>

template<typename... Args>
struct typelist { };

template <typename T>
struct get_type
{
  using type = typename T::type;
};

struct foobar
{
    static const constexpr typelist<> empty{};
};

int main()
{
    using transformed = brigand::transform<decltype(foobar::empty), get_type<brigand::_1>>;
    transformed t;
    return 0;
}

for me, with gcc-9.2 and clang-9, building never terminates (actually, it munches through my 32 gigabytes of RAM in ~1 minute and kills my machine).
It works when replacing e.g. decltype(foobar::empty) with typelist<> directly.

Any idea of where that could come from ?

@jonathanpoelen
Copy link
Contributor

decltype(foobar::empty) = const typelist<>. internally, this builds a list of -1 items (i.e. 18446744073709551615 :D)

Brigand is not designed to work with a constant typelist (nor with volatile or reference). You will need to use std::remove_const_t/std::decay_t.

@jcelerier
Copy link
Author

jcelerier commented Nov 19, 2019

ah, indeed, back<list<>> was the culprit.

would it not be possible to add a partial specialization which handles the cv/ref-qualified empty list case ?

@jfalcou
Copy link
Collaborator

jfalcou commented Nov 19, 2019

Hi,

This is indeed an oversight. We need to decide how to report error : static_assert or be SFINAE friendly and then we can add it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants