Open Quuxplusone opened 8 years ago
Attached plf_test_suite-30f80b.zip
(346670 bytes, application/zip): compiled source and .sh, zipped
This smells like a bug in __typeof handling, based on the source. Tentatively marking as a duplicate.
_This bug has been marked as a duplicate of bug 21973_
This appears to be different. It has to do with dependent types sneaking
through to codegen via templated friend functions (ew). Here's what I got from
reduction:
struct A {
template <class, bool> class B {
template <class r_colony_allocator_type, bool r_is_const,
class distance_type>
friend void advance(B<r_colony_allocator_type, r_is_const> &,
distance_type);
};
template <class r_colony_allocator_type, bool r_is_const, class distance_type>
friend void advance(B<r_colony_allocator_type, r_is_const> &, distance_type) {
distance_type a;
}
};
int main() {
A::B<int, false> b;
advance(b, 0);
}
(In reply to comment #3)
It's slightly more complicated than that, but you've got the basics of it:
template <element_type, element_allocator_type>
class A
{
template <bool>
{
class B
{
template <class colony_allocator_type, bool is_const, class distance_type>
friend void advance(B<colony_allocator_type, is_const> &, distance_type);
};
template <class, bool> class C {
template <class r_colony_allocator_type, bool r_is_const, class distance_type>
friend void advance(B<r_colony_allocator_type, r_is_const> &,
distance_type);
};
template <class colony_allocator_type, bool s_const, class distance_type>
friend void advance(B<colony_allocator_type, is_const> &, distance_type) {
distance_type a;
}
template <class r_colony_allocator_type, bool r_is_const, class distance_type>
friend void advance(C<r_colony_allocator_type, r_is_const> &, distance_type)
{
distance_type a;
}
};
int main() {
A::B<int, false> b;
advance(b, 0);
}
Sorry, please ignore the above. Accidentally tabbed and hit space, submitted without realising it.
Reid, ignoring the compiler crash, can you tell me a better way to structure this based on the example?
Patch https://reviews.llvm.org/D21767 fixes this problem.
plf_test_suite-30f80b.zip
(346670 bytes, application/zip)