* pt.c (unify_pack_expansion): Don't try to deduce generated packs.
* cp-tree.h (TEMPLATE_PARM_P): New.
From-SVN: r258856
+2018-03-26 Jason Merrill <jason@redhat.com>
+
+ PR c++/85049 - ICE with __integer_pack.
+ * pt.c (unify_pack_expansion): Don't try to deduce generated packs.
+ * cp-tree.h (TEMPLATE_PARM_P): New.
+
2018-03-23 Jason Merrill <jason@redhat.com>
PR c++/78489 - wrong SFINAE behavior.
|| TREE_CODE (NODE) == TYPE_DECL \
|| TREE_CODE (NODE) == TEMPLATE_DECL))
+/* Nonzero for a raw template parameter node. */
+#define TEMPLATE_PARM_P(NODE) \
+ (TREE_CODE (NODE) == TEMPLATE_TYPE_PARM \
+ || TREE_CODE (NODE) == TEMPLATE_TEMPLATE_PARM \
+ || TREE_CODE (NODE) == TEMPLATE_PARM_INDEX)
+
/* Mark NODE as a template parameter. */
#define SET_DECL_TEMPLATE_PARM_P(NODE) \
(DECL_LANG_FLAG_0 (NODE) = 1)
tree parm_pack = TREE_VALUE (pack);
int idx, level;
+ /* Only template parameter packs can be deduced, not e.g. function
+ parameter packs or __bases or __integer_pack. */
+ if (!TEMPLATE_PARM_P (parm_pack))
+ continue;
+
/* Determine the index and level of this parameter pack. */
template_parm_level_and_index (parm_pack, &level, &idx);
if (level < levels)
--- /dev/null
+// PR c++/85049
+// { dg-do compile { target c++11 } }
+
+typedef __SIZE_TYPE__ size_t;
+template<typename _Tp, _Tp... _Idx>
+struct integer_sequence
+{
+ typedef _Tp value_type;
+ static constexpr size_t size() noexcept { return sizeof...(_Idx); }
+};
+template<typename _Tp, _Tp _Num>
+using make_integer_sequence = integer_sequence<_Tp, __integer_pack(_Num)...>;
+template<size_t _Num>
+using make_index_sequence = make_integer_sequence<size_t, _Num>;
+template<typename... _Types>
+using index_sequence_for = make_index_sequence<sizeof...(_Types)>;
+template <typename...>
+struct tuple {};
+template <typename... Ts>
+int get(tuple<index_sequence_for<Ts...>, Ts...>);
+int x = get(tuple<index_sequence_for<>>{});