Commit 49f210a2 by Mark Mitchell Committed by Mark Mitchell

re PR c++/23914 (further 'non-constant' template argument case exposed by Boost)

	PR c++/23914
	* parser.c (cp_parser_enclosed_template_argument_list): Make sure
	skip_evaluation is false when processing template arguments.

	PR c++/23914
	* g++.dg/template/static18.C: New test.

From-SVN: r104350
parent 2749a921
2005-09-16 Mark Mitchell <mark@codesourcery.com> 2005-09-16 Mark Mitchell <mark@codesourcery.com>
PR c++/23914
* parser.c (cp_parser_enclosed_template_argument_list): Make sure
skip_evaluation is false when processing template arguments.
PR c++/21514 PR c++/21514
* pt.c (check_instantiated_args): Treat uses of anonymous types as * pt.c (check_instantiated_args): Treat uses of anonymous types as
causing type-deduction failure. causing type-deduction failure.
......
...@@ -15411,6 +15411,7 @@ cp_parser_enclosed_template_argument_list (cp_parser* parser) ...@@ -15411,6 +15411,7 @@ cp_parser_enclosed_template_argument_list (cp_parser* parser)
tree saved_qualifying_scope; tree saved_qualifying_scope;
tree saved_object_scope; tree saved_object_scope;
bool saved_greater_than_is_operator_p; bool saved_greater_than_is_operator_p;
bool saved_skip_evaluation;
/* [temp.names] /* [temp.names]
...@@ -15425,6 +15426,10 @@ cp_parser_enclosed_template_argument_list (cp_parser* parser) ...@@ -15425,6 +15426,10 @@ cp_parser_enclosed_template_argument_list (cp_parser* parser)
saved_scope = parser->scope; saved_scope = parser->scope;
saved_qualifying_scope = parser->qualifying_scope; saved_qualifying_scope = parser->qualifying_scope;
saved_object_scope = parser->object_scope; saved_object_scope = parser->object_scope;
/* We need to evaluate the template arguments, even though this
template-id may be nested within a "sizeof". */
saved_skip_evaluation = skip_evaluation;
skip_evaluation = false;
/* Parse the template-argument-list itself. */ /* Parse the template-argument-list itself. */
if (cp_lexer_next_token_is (parser->lexer, CPP_GREATER)) if (cp_lexer_next_token_is (parser->lexer, CPP_GREATER))
arguments = NULL_TREE; arguments = NULL_TREE;
...@@ -15474,6 +15479,7 @@ cp_parser_enclosed_template_argument_list (cp_parser* parser) ...@@ -15474,6 +15479,7 @@ cp_parser_enclosed_template_argument_list (cp_parser* parser)
parser->scope = saved_scope; parser->scope = saved_scope;
parser->qualifying_scope = saved_qualifying_scope; parser->qualifying_scope = saved_qualifying_scope;
parser->object_scope = saved_object_scope; parser->object_scope = saved_object_scope;
skip_evaluation = saved_skip_evaluation;
return arguments; return arguments;
} }
......
2005-09-16 Mark Mitchell <mark@codesourcery.com> 2005-09-16 Mark Mitchell <mark@codesourcery.com>
PR c++/23914
* g++.dg/template/static18.C: New test.
PR c++/21514 PR c++/21514
* g++.dg/template/crash19.C: Remove dg-error marker. * g++.dg/template/crash19.C: Remove dg-error marker.
* g++.dg/template/local4.C: New test. * g++.dg/template/local4.C: New test.
// PR c++/23914
template <class T>
struct foo_template {
static const unsigned complexity = 0;
};
template <int x> struct STATIC_ASSERTION {};
void gcc_402_problem_minimal()
{
sizeof(STATIC_ASSERTION< foo_template<int>::complexity >);
}
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