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
This commit is contained in:
Mark Mitchell 2005-10-10 22:30:17 +00:00
parent 542155d708
commit 5e9edb0f6f
4 changed files with 32 additions and 0 deletions

View File

@ -1,3 +1,10 @@
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>
PR c++/24139

View File

@ -8904,9 +8904,18 @@ cp_parser_template_argument_list (cp_parser* parser)
tree *arg_ary = fixed_args;
tree vec;
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;
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
{
tree argument;
@ -8940,6 +8949,8 @@ cp_parser_template_argument_list (cp_parser* parser)
if (arg_ary != fixed_args)
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;
return vec;
}

View File

@ -1,3 +1,8 @@
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>
* gcc.dg/ucnid-2.c: XFAIL on Solaris.

View File

@ -0,0 +1,9 @@
// PR c++/23437
template <void (*p)()> struct S {
static const int i = 10;
};
void g();
int a[S<g>::i];