Commit cf776105 by Jason Merrill Committed by Jason Merrill

decl.c: Lose arg_looking_for_template.

	* decl.c: Lose arg_looking_for_template.
	(lookup_name_real): Likewise.
	* parse.y: Lose processing_template_arg, template_arg1
	(primary): Likewise.
	* spew.c (yylex): Set lastiddecl for PTYPENAMEs, too.

From-SVN: r17651
parent e7e66632
Tue Feb 3 22:43:42 1998 Jason Merrill <jason@yorick.cygnus.com>
* decl.c: Lose arg_looking_for_template.
(lookup_name_real): Likewise.
* parse.y: Lose processing_template_arg, template_arg1
(primary): Likewise.
* spew.c (yylex): Set lastiddecl for PTYPENAMEs, too.
Tue Feb 3 22:04:01 1998 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu> Tue Feb 3 22:04:01 1998 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu>
* error.c (dump_decl): Fix type of default arguments for template * error.c (dump_decl): Fix type of default arguments for template
......
...@@ -396,9 +396,6 @@ static struct named_label_list *named_label_uses = NULL; ...@@ -396,9 +396,6 @@ static struct named_label_list *named_label_uses = NULL;
in the TREE_PURPOSE slot. */ in the TREE_PURPOSE slot. */
tree static_aggregates; tree static_aggregates;
/* Nonzero if we lookup name inside template argument. */
int arg_looking_for_template;
/* -- end of C++ */ /* -- end of C++ */
/* Two expressions that are constants with value zero. /* Two expressions that are constants with value zero.
...@@ -4679,13 +4676,7 @@ lookup_name_real (name, prefer_type, nonclass) ...@@ -4679,13 +4676,7 @@ lookup_name_real (name, prefer_type, nonclass)
val = from_obj; val = from_obj;
} }
if (TREE_CODE (val) == TEMPLATE_DECL && arg_looking_for_template) if ((TREE_CODE (val) == TEMPLATE_DECL && looking_for_template)
{
/* TEMPLATE_TEMPLATE_PARM node is preferred over TEMPLATE_DECL. */
if (DECL_TEMPLATE_TEMPLATE_PARM_P (val))
val = TREE_TYPE (val);
}
else if ((TREE_CODE (val) == TEMPLATE_DECL && looking_for_template)
|| TREE_CODE (val) == TYPE_DECL || prefer_type <= 0) || TREE_CODE (val) == TYPE_DECL || prefer_type <= 0)
; ;
else if (IDENTIFIER_HAS_TYPE_VALUE (name)) else if (IDENTIFIER_HAS_TYPE_VALUE (name))
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -71,12 +71,6 @@ extern tree strip_attrs PROTO((tree)); ...@@ -71,12 +71,6 @@ extern tree strip_attrs PROTO((tree));
error message if the user supplies an empty conditional expression. */ error message if the user supplies an empty conditional expression. */
static char *cond_stmt_keyword; static char *cond_stmt_keyword;
/* If nonzero, we try to treat TEMPLATE_DECL as argument in template
template parameter. */
static int processing_template_arg;
extern int arg_looking_for_template;
static tree empty_parms PROTO((void)); static tree empty_parms PROTO((void));
/* Nonzero if we have an `extern "C"' acting as an extern specifier. */ /* Nonzero if we have an `extern "C"' acting as an extern specifier. */
...@@ -267,7 +261,7 @@ empty_parms () ...@@ -267,7 +261,7 @@ empty_parms ()
%type <ttype> template_type_parm template_template_parm %type <ttype> template_type_parm template_template_parm
%type <code> template_close_bracket %type <code> template_close_bracket
%type <ttype> template_type template_arg_list template_arg_list_opt %type <ttype> template_type template_arg_list template_arg_list_opt
%type <ttype> template_arg template_arg1 %type <ttype> template_arg
%type <ttype> condition xcond paren_cond_or_null %type <ttype> condition xcond paren_cond_or_null
%type <ttype> type_name nested_name_specifier nested_type ptr_to_mem %type <ttype> type_name nested_name_specifier nested_type ptr_to_mem
%type <ttype> complete_type_name notype_identifier nonnested_type %type <ttype> complete_type_name notype_identifier nonnested_type
...@@ -958,12 +952,6 @@ template_arg_list: ...@@ -958,12 +952,6 @@ template_arg_list:
; ;
template_arg: template_arg:
{ processing_template_arg = 1; }
template_arg1
{ $$ = $2;
processing_template_arg = 0; }
template_arg1:
type_id type_id
{ $$ = groktypename ($1.t); } { $$ = groktypename ($1.t); }
| expr_no_commas %prec ARITHCOMPARE | expr_no_commas %prec ARITHCOMPARE
...@@ -1379,23 +1367,7 @@ primary: ...@@ -1379,23 +1367,7 @@ primary:
if (TREE_CODE ($$) == BIT_NOT_EXPR) if (TREE_CODE ($$) == BIT_NOT_EXPR)
$$ = build_x_unary_op (BIT_NOT_EXPR, TREE_OPERAND ($$, 0)); $$ = build_x_unary_op (BIT_NOT_EXPR, TREE_OPERAND ($$, 0));
else if (TREE_CODE ($$) != TEMPLATE_ID_EXPR) else if (TREE_CODE ($$) != TEMPLATE_ID_EXPR)
{ $$ = do_identifier ($$, 1);
if (processing_template_arg)
{
tree id;
arg_looking_for_template = processing_template_arg;
id = lookup_name ($$, 0);
arg_looking_for_template = 0;
if (!id || id == error_mark_node
|| (TREE_CODE (id) != TEMPLATE_DECL
&& TREE_CODE (id) != TEMPLATE_TEMPLATE_PARM))
id = do_identifier ($$, 1);
$$ = id;
}
else
$$ = do_identifier ($$, 1);
}
} }
| CONSTANT | CONSTANT
| boolean.literal | boolean.literal
......
...@@ -312,22 +312,18 @@ yylex () ...@@ -312,22 +312,18 @@ yylex ()
{ {
case TYPENAME: case TYPENAME:
case SELFNAME: case SELFNAME:
case NSNAME:
lastiddecl = trrr; lastiddecl = trrr;
if (got_scope) if (got_scope)
tmp_token.yylval.ttype = trrr; tmp_token.yylval.ttype = trrr;
break; break;
case PFUNCNAME: case PFUNCNAME:
case IDENTIFIER: case IDENTIFIER:
lastiddecl = trrr;
break;
case PTYPENAME: case PTYPENAME:
lastiddecl = NULL_TREE;
break;
case NSNAME:
lastiddecl = trrr; lastiddecl = trrr;
if (got_scope)
tmp_token.yylval.ttype = trrr;
break; break;
default: default:
my_friendly_abort (101); my_friendly_abort (101);
} }
......
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