This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/60153] Variadic template parameter's typedefs cause internal compile error: in dependent_type_p on RedHat


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60153

--- Comment #3 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
It ICEs at the same place when compiling Eric Niebler's calendar application
from his CppCon 2015 talk "Ranges for the Standard Library":

trippels@gcc2-power8 ~ % cat calendar.ii
template <class value_policies> class constrained_value {
public:
  constrained_value(typename value_policies::value_type);
};
class A {
public:
  typedef int value_type;
};
namespace date_time {
enum { Jan };
}
class F : constrained_value<A> {
public:
  F(int) : constrained_value(0) {}
};
namespace boost {
using date_time::Jan;
class date {
public:
  date(F, int, int);
};
}
template <typename> struct B;
enum cardinality { infinite };
template <typename = void> struct C;
template <typename Bind> struct G : Bind, B<G<Bind>> {};
struct {
  template <typename Fun> G<Fun> operator()(Fun);
} make_pipeable;
struct pipeable_access {
  template <typename Pipeable> struct impl : Pipeable {};
};
template <typename> struct B {
  template <typename Arg, typename Pipe>
  static auto pipe(Arg arg, Pipe pipe) -> decltype(pipe(arg));
};
template <typename Arg, typename Pipe>
auto operator|(Arg arg, Pipe pipe)
    -> decltype(pipeable_access::impl<Pipe>::pipe(arg, pipe));
struct D {
  template <typename Container,
            typename = typename Container::allocator_typetype>
  operator Container();
};
template <typename, cardinality> struct H : D {};
template <> struct C<> : H<C<>, infinite> {};
namespace view {
struct {
  template <typename From> C<> operator()(From);
} iota;
}
namespace greg = boost;
using greg::date;
auto dates(int) { return view::iota(date{0, greg::Jan, 0}); }
auto format_calendar() {
  return make_pipeable([](auto) {});
}
int main() { dates(0) | format_calendar(); }

trippels@gcc2-power8 ~ % g++ -std=c++14 -O0 -c calendar.ii
calendar.ii: In substitution of âtemplate<class Container, class> D::operator
Container() [with Container = auto:1; <template-parameter-1-2> = <missing>]â:
calendar.ii:35:56:   required by substitution of âtemplate<class Arg, class
Pipe> static decltype (pipe(arg)) B< <template-parameter-1-1> >::pipe(Arg,
Pipe) [with Arg = C<>; Pipe = G<format_calendar()::<lambda(auto:1)> >]â
calendar.ii:39:50:   required by substitution of âtemplate<class Arg, class
Pipe> decltype (pipeable_access::impl<Pipe>::pipe(arg, pipe)) operator|(Arg,
Pipe) [with Arg = C<>; Pipe = G<format_calendar()::<lambda(auto:1)> >]â
calendar.ii:58:41:   required from here
calendar.ii:42:13: internal compiler error: in dependent_type_p, at
cp/pt.c:21951
             typename = typename Container::allocator_typetype>
             ^
0x101e3d73 dependent_type_p(tree_node*)
        ../../gcc/gcc/cp/pt.c:21951
0x101e47b7 dependent_scope_p(tree_node*)
        ../../gcc/gcc/cp/pt.c:21982
0x101ba487 make_typename_type(tree_node*, tree_node*, tag_types, int)
        ../../gcc/gcc/cp/decl.c:3569
0x101fb6c7 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/gcc/cp/pt.c:13266
0x102283d7 type_unification_real
        ../../gcc/gcc/cp/pt.c:17935
0x102392e3 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, bool, bool)
        ../../gcc/gcc/cp/pt.c:17202
0x10181c9b add_template_candidate_real
        ../../gcc/gcc/cp/call.c:3063
0x101828cf add_template_candidate
        ../../gcc/gcc/cp/call.c:3160
0x101828cf add_candidates
        ../../gcc/gcc/cp/call.c:5316
0x1017d97f build_user_type_conversion_1
        ../../gcc/gcc/cp/call.c:3712
0x1017e97b implicit_conversion
        ../../gcc/gcc/cp/call.c:1862
0x101806b7 add_conv_candidate
        ../../gcc/gcc/cp/call.c:2216
0x10181d13 add_template_candidate_real
        ../../gcc/gcc/cp/call.c:3114
0x101895d3 add_template_conv_candidate
        ../../gcc/gcc/cp/call.c:3175
0x101895d3 build_op_call_1
        ../../gcc/gcc/cp/call.c:4328
0x101895d3 build_op_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int)
        ../../gcc/gcc/cp/call.c:4390
0x10383893 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**,
bool, bool, int)
        ../../gcc/gcc/cp/semantics.c:2408
0x102204db tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc/gcc/cp/pt.c:16088
0x101fa7d3 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/gcc/cp/pt.c:13345
0x10219beb tsubst_function_type
        ../../gcc/gcc/cp/pt.c:12414

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]