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. From-SVN: r258856
This commit is contained in:
parent
aafaa3254e
commit
ddd5c5b7c6
4 changed files with 38 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
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.
|
||||
|
|
|
@ -4554,6 +4554,12 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
|
|||
|| 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)
|
||||
|
|
|
@ -20645,6 +20645,11 @@ unify_pack_expansion (tree tparms, tree targs, tree packed_parms,
|
|||
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)
|
||||
|
|
21
gcc/testsuite/g++.dg/ext/integer-pack3.C
Normal file
21
gcc/testsuite/g++.dg/ext/integer-pack3.C
Normal file
|
@ -0,0 +1,21 @@
|
|||
// 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<>>{});
|
Loading…
Add table
Reference in a new issue