PR c++/51191 - ICE on alias of alias template instantiation
authorDodji Seketeli <dodji@redhat.com>
Fri, 18 Nov 2011 14:07:41 +0000 (14:07 +0000)
committerDodji Seketeli <dodji@gcc.gnu.org>
Fri, 18 Nov 2011 14:07:41 +0000 (15:07 +0100)
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
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/alias-decl-13.C [new file with mode: 0644]

index c5f2a7b4851cd2c520bd3bf4c357f46b81d400d8..26d3c293da30430e125abbad5af38d61cff008b9 100644 (file)
@@ -1,3 +1,9 @@
+2011-11-18  Dodji Seketeli  <dodji@redhat.com>
+
+       PR c++/51191
+       * pt.c (primary_template_instantiation_p): Don't forget to
+       consider alias declarations.
+
 2011-11-17  Jason Merrill  <jason@redhat.com>
 
        PR c++/51186
index 97380260ae46f5573e8990160f7ee14f4126f323..78e263f9e95bb22e2370afb97e9f9f8f369f008f 100644 (file)
@@ -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)
index fa4ab0d59694ee9f1de2f8c4367cd885b4ecde88..f3157fc207c706fff13da65c667e4efdd114ed6d 100644 (file)
@@ -1,3 +1,8 @@
+2011-11-18  Dodji Seketeli  <dodji@redhat.com>
+
+       PR c++/51191
+       * g++.dg/cpp0x/alias-decl-13.C: New test.
+
 2011-11-17  Jason Merrill  <jason@redhat.com>
 
        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 (file)
index 0000000..8555154
--- /dev/null
@@ -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<T>::type >;
+
+using Alias = TemplateAlias<int>;
+
+template< class T >
+void f( TemplateAlias<T> );
+
+int main()
+{
+  Alias x;
+  f( x ); // { dg-error "no matching function for call to|f" }
+}