]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
pt.c (tsubst_template_parms): Call maybe_fold_nontype_arg and tsubst_expr for default...
authorKriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
Thu, 26 Jul 2001 12:48:01 +0000 (12:48 +0000)
committerKriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org>
Thu, 26 Jul 2001 12:48:01 +0000 (12:48 +0000)
2001-07-22  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>

* pt.c (tsubst_template_parms): Call maybe_fold_nontype_arg and
tsubst_expr for default template arguments.

2001-07-22  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>

* g++.old-deja/g++.pt/defarg14.C: New test.

From-SVN: r44396

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.old-deja/g++.pt/defarg14.C [new file with mode: 0644]

index dd1be64de8e7acd3e5940e128d8116058ab6daf5..756924940da850cb76da3fed4c2877386abf5fd3 100644 (file)
@@ -1,3 +1,8 @@
+2001-07-26  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
+
+       * pt.c (tsubst_template_parms): Call maybe_fold_nontype_arg and
+       tsubst_expr for default template arguments.
+
 2001-07-26  Nathan Sidwell  <nathan@codesourcery.com>
 
        * spew.c (yylex): Only copy the token's lineno, if it is
index d09ce8f70ca02bc2030fd3c1d142b03e94d7aa5e..1f40089a4b59a3a7fabeed2e83bc8b93c5098919 100644 (file)
@@ -5377,8 +5377,9 @@ tsubst_template_parms (parms, args, complain)
            TREE_VALUE (TREE_VEC_ELT (TREE_VALUE (parms), i));
          
          TREE_VEC_ELT (new_vec, i)
-           = build_tree_list (tsubst (default_value, args, complain,
-                                      NULL_TREE), 
+           = build_tree_list (maybe_fold_nontype_arg (
+                                 tsubst_expr (default_value, args, complain,
+                                              NULL_TREE)), 
                               tsubst (parm_decl, args, complain,
                                       NULL_TREE));
        }
index f2354d4a76e6c288f59ae8ce60d57ea70bcc4d8f..5b9ab08a692eca3052c4bb4e794fd983dfe11d64 100644 (file)
@@ -1,3 +1,7 @@
+2001-07-26  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
+
+       * g++.old-deja/g++.pt/defarg14.C: New test.
+
 2001-07-26  Nathan Sidwell  <nathan@codesourcery.com>
 
        * g++.old-deja/g++.other/lineno5.C: New test.
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/defarg14.C b/gcc/testsuite/g++.old-deja/g++.pt/defarg14.C
new file mode 100644 (file)
index 0000000..7ae4941
--- /dev/null
@@ -0,0 +1,18 @@
+// Build don't link:
+
+// Origin: Larry Evans <jcampbell3@prodigy.net>
+
+// Bug: enum in default template arguments are not properly handled.
+
+enum Enum0 { E0, E1, E2 };
+enum Enum1 { E3=E2+1, E4=E3+1 };
+
+template <Enum0 Out_FARG0> class OutTmpl
+{
+  public:
+    template <Enum0 In_FARG0, Enum1 In_FARG1=E4> class InTmpl
+    {
+    };
+};
+
+OutTmpl<E1> m;