Patchwork C++ PATCH for c++/54859 (bogus errors with alias templates)

login
register
mail settings
Submitter Jason Merrill
Date Nov. 9, 2012, 9:17 p.m.
Message ID <509D72E0.4090205@redhat.com>
Download mbox | patch
Permalink /patch/198151/
State New
Headers show

Comments

Jason Merrill - Nov. 9, 2012, 9:17 p.m.
My patch for 54575 started using instantiate_template for alias 
templates, but instantiate_template wasn't prepared to instantiate with 
dependent template arguments.  Fixed thus.

Tested x86_64-pc-linux-gnu, applied to trunk.

Patch

commit 11ab97f0fe9a7262362f4ef997562f32028e18e4
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Nov 8 16:17:41 2012 -0500

    	PR c++/54859
    	* pt.c (check_instantiated_arg): Don't complain about dependent args.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 1ff1c73..50d12b0 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -14362,6 +14362,8 @@  tsubst_copy_and_build (tree t,
 static bool
 check_instantiated_arg (tree tmpl, tree t, tsubst_flags_t complain)
 {
+  if (dependent_template_arg_p (t))
+    return false;
   if (ARGUMENT_PACK_P (t))
     {
       tree vec = ARGUMENT_PACK_ARGS (t);
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-25.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-25.C
new file mode 100644
index 0000000..e72bd35
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-25.C
@@ -0,0 +1,10 @@ 
+// PR c++/54859
+// { dg-options -std=c++11 }
+
+template<unsigned N>
+  using Num = int;
+
+template<typename... Types>
+  using Count = Num<sizeof...(Types)>;
+
+Count<int, char, void> i;