re PR c++/10224 (Problem with integral constants (+ICE))
authorNathan Sidwell <nathan@codesourcery.com>
Thu, 27 Mar 2003 14:04:28 +0000 (14:04 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Thu, 27 Mar 2003 14:04:28 +0000 (14:04 +0000)
cp:
PR c++/10224
* pt.c (lookup_template_class): Only check instantiated args if
they do not contain template parameters.
testsuite:
PR c++/10224
* g++.dg/template/arg3.C: New test.

From-SVN: r64923

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/arg3.C [new file with mode: 0644]

index 8d835ece2c90b05d104dbe3d2465f57010be6f3a..c74767904997b23ebde4eb0b0cb21c886e35e3cf 100644 (file)
@@ -1,3 +1,9 @@
+2003-03-27  Nathan Sidwell  <nathan@codesourcery.com>
+
+       PR c++/10224
+       * pt.c (lookup_template_class): Only check instantiated args if
+       they do not contain template parameters.
+
 2003-03-27  Nathan Sidwell  <nathan@codesourcery.com>
 
        PR c++/10158
index c04c602d8675fe90b5c08ea96fc45394b981b0bd..a79b8a57846321a18d2041fef4555005a2597283 100644 (file)
@@ -4181,7 +4181,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
       arglist2 = coerce_template_parms (parmlist, arglist, template,
                                         complain, /*require_all_args=*/1);
       if (arglist2 == error_mark_node
-         || (!processing_template_decl
+         || (!uses_template_parms (arglist2)
              && check_instantiated_args (template, arglist2, complain)))
         POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
 
@@ -4272,7 +4272,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
                                   complain, /*require_all_args=*/1);
 
       if (arglist == error_mark_node
-         || (!processing_template_decl
+         || (!uses_template_parms (INNERMOST_TEMPLATE_ARGS (arglist))
              && check_instantiated_args (template,
                                          INNERMOST_TEMPLATE_ARGS (arglist),
                                          complain)))
index cb6431052c17a0119ff18a66efec381c36c6a45d..405556d9d81891dd0810dfcbad36f32a3b06658d 100644 (file)
@@ -1,5 +1,8 @@
 2003-03-27  Nathan Sidwell  <nathan@codesourcery.com>
 
+       PR c++/10224
+       * g++.dg/template/arg3.C: New test.
+
        PR c++/10158
        * g++.dg/template/friend18.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/template/arg3.C b/gcc/testsuite/g++.dg/template/arg3.C
new file mode 100644 (file)
index 0000000..050aa33
--- /dev/null
@@ -0,0 +1,17 @@
+// { dg-do compile }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 27 Mar 2003 <nathan@codesourcery.com>
+
+// PR 10224. Rejected a valid constant argument.
+
+template <bool B> struct X {
+  struct I {};
+};
+
+template <typename T> struct Y {
+  static const bool selector = true;
+  typedef typename X<selector>::I helper;
+};
+
+Y<int> i;