These are chat archives for boostorg/hana

10th
Jan 2016
Maik Klein
@MaikKlein
Jan 10 2016 13:29
Did anyone run into a compiler seqfault with clang 3.7 + hana yet?
Maik Klein
@MaikKlein
Jan 10 2016 13:47
Just came back to some old code :d
template <class Tup>
auto tuple_ref(Tup&  tup)
{
  return hana::transform(tup, [](auto& t) { return std::ref(t); });
}

   ....
    auto cg_ref = tuple_ref(component_groups_tuple);
    auto filterd_cg_ref = hana::filter(cg_ref, [](auto& cg) {
      return hana::bool_c<true>;
    });
Seems like something weird is going on with std::reference_wrapper and filter, I will try to make an isolated example later.
Maik Klein
@MaikKlein
Jan 10 2016 15:36
struct position
{
  float x, y;
};
struct velocity
{
  float x, y;
};

int main()
{
  auto tup = hana::make_tuple(position{1,2}, velocity{1,2});
  auto tup_ref =  hana::transform(tup, [](auto& t) { return std::ref(t); });
  auto test = hana::filter(tup_ref, [](auto& tref){
    return hana::bool_c<true>;
  });
}
1.      <eof> parser at end of file
2.      ../dependencies/hana/include/boost/hana/filter.hpp:103:18: instantiating function definition 'operator()'
3.      ../dependencies/hana/include/boost/hana/filter.hpp:103:18: LLVM IR generation of declaration 'boost::hana::detail::make_filter_indices<(lambda at ../examples/ecs/main.cpp:113:37)>::operator()'
4.      ../dependencies/hana/include/boost/hana/filter.hpp:103:18: Mangling declaration 'boost::hana::detail::make_filter_indices<(lambda at ../examples/ecs/main.cpp:113:37)>::operator()'
clang-3.7: error: unable to execute command: Segmentation fault (core dumped)
clang-3.7: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 3.7.0 (tags/RELEASE_370/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang-3.7: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
clang-3.7: note: diagnostic msg:
This is in master, works in 0.6.0. Just wanted to let you know. Should I make a github issue?
Maik Klein
@MaikKlein
Jan 10 2016 17:29
Haha lol now another library also results in an ICE, what is going on today.
Jason Rice
@ricejasonf
Jan 10 2016 20:01
Is that using libstd++?
Maik Klein
@MaikKlein
Jan 10 2016 21:00
don't know, is libstd++ default in clang?
Jason Rice
@ricejasonf
Jan 10 2016 22:32
It depends on the system. Linux distros typically use libstd++. My version of Ubuntu uses gcc 5.0 by default which has bugs that break hana. When I upgraded to 5.1 they went away. (It was throwing up with large maps https://gist.github.com/ricejasonf/c2cd831d207912583549#file-large_map_1-cpp)
@MaikKlein ^
Maik Klein
@MaikKlein
Jan 10 2016 22:51
Should I use libc++ or libstdc++?
Jason Rice
@ricejasonf
Jan 10 2016 22:53
I guess libc++ is better, but I use libstd++ because my system libraries are compiled with it.
but it needs to be >=5.1
Maik Klein
@MaikKlein
Jan 10 2016 22:54

btw is there some restriction in hana::filter?

    auto components_filter = hana::filter(components_ref, [&filter](auto cref) {
      return contains_type(filter, cref.get());
    });

If I create a custom move constructor for the type of cref it doesn't compile anymore and throws

../dependencies/hana/include/boost/hana/basic_tuple.hpp:168:20: error: no matching function for call to object of type 'boost::hana::detail::make_filter_indices<(lambda at ../src/ecs/core/core.hpp:39:59)>'
            return static_cast<F&&>(f)(
No idea what to make of it
cref is also a reference_wrapper of type T where type T has a custom move constructor.
Jason Rice
@ricejasonf
Jan 10 2016 23:02
does it say anything about the candidate functions?
maybe it has something to do with the decay that was added
Maik Klein
@MaikKlein
Jan 10 2016 23:03
It's this
return Unpack::apply(static_cast<Xs&&>(xs), static_cast<F&&>(f));
I try to make a self contained example
Jason Rice
@ricejasonf
Jan 10 2016 23:04
Is there anything like this in your errors? "candidate template ignored: substitution failure"
Maik Klein
@MaikKlein
Jan 10 2016 23:08
yes
note: candidate template ignored: substitution failure [with X = <const std::reference_wrapper<breeze::util::container::handle_container<position, std::vector<position, std::allocator<position> > > > &, const std::reference_wrapper<breeze::util::container::handle_container<velocity, std::vector<velocity, std::allocator<velocity> > > > &>]
            auto operator()(X&& ...x) const -> filter_indices<
nvm oh my god
Maik Klein
@MaikKlein
Jan 10 2016 23:13
I am so stupid
Jason Rice
@ricejasonf
Jan 10 2016 23:14
What does your contains_type function return?
Maik Klein
@MaikKlein
Jan 10 2016 23:14
lol
constexpr auto contains_type(Tup&& tup, T)
forgot to make it T&
god damn it that should have been obvious
Jason Rice
@ricejasonf
Jan 10 2016 23:16
for a parameter that isn't used?
Maik Klein
@MaikKlein
Jan 10 2016 23:16
yes
I thought it shouldn'T matter
Jason Rice
@ricejasonf
Jan 10 2016 23:17
lol.... "shouldn'T"
Maik Klein
@MaikKlein
Jan 10 2016 23:17
template <class Tup, class T>
constexpr auto contains_type(Tup&& tup, T&)
{
  return hana::contains(tup, hana::type_c<T>);
}
Jason Rice
@ricejasonf
Jan 10 2016 23:18
ooh
Maik Klein
@MaikKlein
Jan 10 2016 23:20
Not quite sure why I got the error with static_castthough.
btw I have gcc 5.3 so I think my library should be recent enough?
Could you compile this with master?
```
struct position
{
  float x, y;
};
struct velocity
{
  float x, y;
};

int main()
{
  auto tup = hana::make_tuple(position{1,2}, velocity{1,2});
  auto tup_ref =  hana::transform(tup, [](auto& t) { return std::ref(t); });
  auto test = hana::filter(tup_ref, [](auto& tref){
    return hana::bool_c<true>;
  });
}
Jason Rice
@ricejasonf
Jan 10 2016 23:28
yes
Maik Klein
@MaikKlein
Jan 10 2016 23:28
does it also ice for you?
Jason Rice
@ricejasonf
Jan 10 2016 23:28
ice?
Maik Klein
@MaikKlein
Jan 10 2016 23:28
internal compiler error
Jason Rice
@ricejasonf
Jan 10 2016 23:28
no
Maik Klein
@MaikKlein
Jan 10 2016 23:29
hm k
Jason Rice
@ricejasonf
Jan 10 2016 23:30
It could be that you are still using an old version of libstd++ on your system
I don't remember how I fixed that on mine.
Maik Klein
@MaikKlein
Jan 10 2016 23:31
I think that is the problem
readelf -sV /usr/lib/libstdc++.so.6 | sed -n 's/.*@@GLIBCXX_//p' | sort -u -V | tail -1
gives me version 3.4.21
Jason Rice
@ricejasonf
Jan 10 2016 23:34
I want to say changing the symlink for the g++ binary fixed it.
Maik Klein
@MaikKlein
Jan 10 2016 23:36
does the command above print 5.1 for you?