re PR c++/41785 ([C++0x] ICE on canonical types with variadic templates and CRTP)
Fix PR c++/41785 gcc/cp/ChangeLog: PR c++/41785 * pt.c (template_args_equal): Handle comparison of an ARGUMENT_PACK_SELECT node with the arguments node it selects into. * cp-tree.def: Fix a typo in the description of TYPE_PACK_EXPANSION. gcc/testsuite/ChangeLog: PR c++/41785 * gcc/testsuite/g++.dg/cpp0x/variadic96.C: New test. From-SVN: r153564
This commit is contained in:
parent
65a324b459
commit
f96d6fd02e
5 changed files with 51 additions and 1 deletions
|
@ -1,3 +1,10 @@
|
|||
2009-10-26 Dodji Seketeli <dodji@redhat.com>
|
||||
|
||||
PR c++/41785
|
||||
* pt.c (template_args_equal): Handle comparison of
|
||||
an ARGUMENT_PACK_SELECT node with the arguments node it selects into.
|
||||
* cp-tree.def: Fix a typo in the description of TYPE_PACK_EXPANSION.
|
||||
|
||||
2009-10-26 Dodji Seketeli <dodji@redhat.com>
|
||||
|
||||
PR c++/41020
|
||||
|
|
|
@ -393,7 +393,7 @@ DEFTREECODE (NONTYPE_ARGUMENT_PACK, "nontype_argument_pack", tcc_expression, 1)
|
|||
};
|
||||
|
||||
The derivation from tuple contains a TYPE_PACK_EXPANSION for the
|
||||
template arguments. Its EXPR_PACK_EXPANSION is "Values&" and its
|
||||
template arguments. Its PACK_EXPANSION_PATTERN is "Values&" and its
|
||||
PACK_EXPANSION_PARAMETER_PACKS will contain "Values". */
|
||||
DEFTREECODE (TYPE_PACK_EXPANSION, "type_pack_expansion", tcc_type, 0)
|
||||
|
||||
|
|
12
gcc/cp/pt.c
12
gcc/cp/pt.c
|
@ -5818,6 +5818,18 @@ template_args_equal (tree ot, tree nt)
|
|||
return 0;
|
||||
return 1;
|
||||
}
|
||||
else if (ot && TREE_CODE (ot) == ARGUMENT_PACK_SELECT)
|
||||
{
|
||||
/* We get here probably because we are in the middle of substituting
|
||||
into the pattern of a pack expansion. In that case the
|
||||
ARGUMENT_PACK_SELECT temporarily replaces the pack argument we are
|
||||
interested in. So we want to use the initial pack argument for
|
||||
the comparison. */
|
||||
ot = ARGUMENT_PACK_SELECT_FROM_PACK (ot);
|
||||
if (nt && TREE_CODE (nt) == ARGUMENT_PACK_SELECT)
|
||||
nt = ARGUMENT_PACK_SELECT_FROM_PACK (nt);
|
||||
return template_args_equal (ot, nt);
|
||||
}
|
||||
else if (TYPE_P (nt))
|
||||
return TYPE_P (ot) && same_type_p (ot, nt);
|
||||
else if (TREE_CODE (ot) == TREE_VEC || TYPE_P (ot))
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2009-10-26 Dodji Seketeli <dodji@redhat.com>
|
||||
|
||||
PR c++/41785
|
||||
* gcc/testsuite/g++.dg/cpp0x/variadic96.C: New test.
|
||||
|
||||
2009-10-26 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
* lib/target-supports.exp (check_profiling_available):
|
||||
|
|
26
gcc/testsuite/g++.dg/cpp0x/variadic96.C
Normal file
26
gcc/testsuite/g++.dg/cpp0x/variadic96.C
Normal file
|
@ -0,0 +1,26 @@
|
|||
// Contributed by Dodji Seketeli <dodji@redhat.com>
|
||||
// Origin: PR c++/41785
|
||||
// { dg-options -std=c++0x }
|
||||
|
||||
struct a {};
|
||||
|
||||
template < typename T, typename ENCLOSING >
|
||||
struct base;
|
||||
|
||||
template < typename... T >
|
||||
struct derived
|
||||
: public base< T, derived< T... > >...
|
||||
{};
|
||||
|
||||
template < typename... T>
|
||||
struct base< a, derived< T... > >
|
||||
{
|
||||
typedef derived< T... >
|
||||
Derived;
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
derived< a > instance;
|
||||
}
|
||||
|
Loading…
Add table
Reference in a new issue