From d808e92ea950feeba41a5019ada7cddbbe0a5ed7 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 25 Feb 2014 13:53:45 -0500 Subject: [PATCH] DR 1286 PR c++/60328 DR 1286 PR c++/60328 * pt.c (get_underlying_template): Fix equivalence calculation. From-SVN: r208152 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/pt.c | 7 +++++-- gcc/testsuite/g++.dg/cpp0x/alias-decl-dr1286b.C | 12 ++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-dr1286b.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5afc6d8..7f63b8e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2014-02-25 Jason Merrill + + DR 1286 + PR c++/60328 + * pt.c (get_underlying_template): Fix equivalence calculation. + 2014-02-25 Adam Butcher PR c++/60311 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index bd59142..4a9fa71 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -5185,9 +5185,12 @@ get_underlying_template (tree tmpl) tree sub = TYPE_TI_TEMPLATE (result); if (PRIMARY_TEMPLATE_P (sub) && (num_innermost_template_parms (tmpl) - == num_innermost_template_parms (sub)) - && same_type_p (result, TREE_TYPE (sub))) + == num_innermost_template_parms (sub))) { + tree alias_args = INNERMOST_TEMPLATE_ARGS + (template_parms_to_args (DECL_TEMPLATE_PARMS (tmpl))); + if (!comp_template_args (TYPE_TI_ARGS (result), alias_args)) + break; /* The alias type is equivalent to the pattern of the underlying template, so strip the alias. */ tmpl = sub; diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-dr1286b.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-dr1286b.C new file mode 100644 index 0000000..fef9818 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-dr1286b.C @@ -0,0 +1,12 @@ +// PR c++/60328 +// { dg-require-effective-target c++11 } + +template +struct Foo +{ + template + using Bar = Foo<_TT, _RR...>; + + using Normal = Foo<_Rest...>; + using Fail = Bar<_Rest...>; +}; -- 2.7.4