From: Jason Merrill Date: Tue, 25 Feb 2014 18:53:45 +0000 (-0500) Subject: DR 1286 PR c++/60328 X-Git-Tag: upstream/12.2.0~64484 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d808e92ea950feeba41a5019ada7cddbbe0a5ed7;p=platform%2Fupstream%2Fgcc.git DR 1286 PR c++/60328 DR 1286 PR c++/60328 * pt.c (get_underlying_template): Fix equivalence calculation. From-SVN: r208152 --- 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...>; +};