Commit 5e9edb0f by Mark Mitchell

Mark Mitchell <mark@codesourcery.com> PR c++/23437

	    Mark Mitchell  <mark@codesourcery.com>
        PR c++/23437
	* parser.c (cp_parser_template_argument_list): Do not treat
	contents of argument list as part of a constant expression.
	PR c++/23437
	* g++.dg/template/arg4.C: New test.

From-SVN: r105199
parent 542155d7
2005-10-10 Giovanni Bajo <giovannibajo@gcc.gnu.org>
Mark Mitchell <mark@codesourcery.com>
PR c++/23437
* parser.c (cp_parser_template_argument_list): Do not treat
contents of argument list as part of a constant expression.
2005-10-10 Mark Mitchell <mark@codesourcery.com> 2005-10-10 Mark Mitchell <mark@codesourcery.com>
PR c++/24139 PR c++/24139
......
...@@ -8904,9 +8904,18 @@ cp_parser_template_argument_list (cp_parser* parser) ...@@ -8904,9 +8904,18 @@ cp_parser_template_argument_list (cp_parser* parser)
tree *arg_ary = fixed_args; tree *arg_ary = fixed_args;
tree vec; tree vec;
bool saved_in_template_argument_list_p; bool saved_in_template_argument_list_p;
bool saved_ice_p;
bool saved_non_ice_p;
saved_in_template_argument_list_p = parser->in_template_argument_list_p; saved_in_template_argument_list_p = parser->in_template_argument_list_p;
parser->in_template_argument_list_p = true; parser->in_template_argument_list_p = true;
/* Even if the template-id appears in an integral
constant-expression, the contents of the argument list do
not. */
saved_ice_p = parser->integral_constant_expression_p;
parser->integral_constant_expression_p = false;
saved_non_ice_p = parser->non_integral_constant_expression_p;
parser->non_integral_constant_expression_p = false;
do do
{ {
tree argument; tree argument;
...@@ -8940,6 +8949,8 @@ cp_parser_template_argument_list (cp_parser* parser) ...@@ -8940,6 +8949,8 @@ cp_parser_template_argument_list (cp_parser* parser)
if (arg_ary != fixed_args) if (arg_ary != fixed_args)
free (arg_ary); free (arg_ary);
parser->non_integral_constant_expression_p = saved_non_ice_p;
parser->integral_constant_expression_p = saved_ice_p;
parser->in_template_argument_list_p = saved_in_template_argument_list_p; parser->in_template_argument_list_p = saved_in_template_argument_list_p;
return vec; return vec;
} }
......
2005-10-10 Mark Mitchell <mark@codesourcery.com>
PR c++/23437
* g++.dg/template/arg4.C: New test.
2005-10-10 Eric Botcazou <ebotcazou@libertysurf.fr> 2005-10-10 Eric Botcazou <ebotcazou@libertysurf.fr>
* gcc.dg/ucnid-2.c: XFAIL on Solaris. * gcc.dg/ucnid-2.c: XFAIL on Solaris.
// PR c++/23437
template <void (*p)()> struct S {
static const int i = 10;
};
void g();
int a[S<g>::i];
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment