From 0c3251f0aa0a8c8cc8d667b476840eafb6cc7cac Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Fri, 18 Nov 2011 14:07:41 +0000 Subject: PR c++/51191 - ICE on alias of alias template instantiation gcc/cp/ PR c++/51191 * pt.c (primary_template_instantiation_p): Don't forget to consider alias declarations. gcc/testsuite/ PR c++/51191 * g++.dg/cpp0x/alias-decl-13.C: New test. From-SVN: r181475 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/pt.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp0x/alias-decl-13.C | 24 ++++++++++++++++++++++++ 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-13.C (limited to 'gcc') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c5f2a7b..26d3c29 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-11-18 Dodji Seketeli + + PR c++/51191 + * pt.c (primary_template_instantiation_p): Don't forget to + consider alias declarations. + 2011-11-17 Jason Merrill PR c++/51186 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 9738026..78e263f 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -2870,7 +2870,7 @@ primary_template_instantiation_p (const_tree t) return DECL_LANG_SPECIFIC (t) && DECL_TEMPLATE_INSTANTIATION (t) && PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (t)); - else if (CLASS_TYPE_P (t)) + else if (CLASS_TYPE_P (t) && !TYPE_DECL_ALIAS_P (TYPE_NAME (t))) return CLASSTYPE_TEMPLATE_INSTANTIATION (t) && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (t)); else if (TYPE_P (t) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fa4ab0d..f3157fc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-11-18 Dodji Seketeli + + PR c++/51191 + * g++.dg/cpp0x/alias-decl-13.C: New test. + 2011-11-17 Jason Merrill PR c++/51186 diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-13.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-13.C new file mode 100644 index 0000000..8555154 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-13.C @@ -0,0 +1,24 @@ +// Origin PR c++/51191 +// { dg-options "-std=c++0x" } + +template< class T > +class ClassTemplate {}; + +template< class T > +struct Metafunction { + typedef T type; +}; + +template< class T > +using TemplateAlias = ClassTemplate< typename Metafunction::type >; + +using Alias = TemplateAlias; + +template< class T > +void f( TemplateAlias ); + +int main() +{ + Alias x; + f( x ); // { dg-error "no matching function for call to|f" } +} -- cgit v1.1