This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.
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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]