Commit 11686454 by Jason Merrill Committed by Jason Merrill

parse.y (nested_name_specifier): Use explicit_template_type.

	* parse.y (nested_name_specifier): Use explicit_template_type.
	(typename_sub): Allow a template_type, an explicit_template_type,
	or an implicit template type at the end.
	* lex.c (yyprint): Handle a PTYPENAME being a TEMPLATE_DECL.
	* decl.c (make_typename_type): Handle template-id where the name
	is a TEMPLATE_DECL.
	* call.c (build_scoped_method_call): Handle member template
	destructor call.
	* pt.c (tsubst_copy, METHOD_CALL_EXPR): Don't assume a member
	destructor is represented by the type.

From-SVN: r18303
parent b2b7d40a
Sat Feb 28 12:06:44 1998 Jason Merrill <jason@yorick.cygnus.com> Sat Feb 28 12:06:44 1998 Jason Merrill <jason@yorick.cygnus.com>
* parse.y (nested_name_specifier): Use explicit_template_type.
(typename_sub): Allow a template_type, an explicit_template_type,
or an implicit template type at the end.
* lex.c (yyprint): Handle a PTYPENAME being a TEMPLATE_DECL.
* decl.c (make_typename_type): Handle template-id where the name
is a TEMPLATE_DECL.
* call.c (build_scoped_method_call): Handle member template
destructor call.
* pt.c (tsubst_copy, METHOD_CALL_EXPR): Don't assume a member
destructor is represented by the type.
* cp-tree.h (TYPENAME_TYPE_FULLNAME): New macro. * cp-tree.h (TYPENAME_TYPE_FULLNAME): New macro.
* parse.y (nested_name_specifier): Add 'template' case. * parse.y (nested_name_specifier): Add 'template' case.
(explicit_template_type): New rule. (explicit_template_type): New rule.
......
...@@ -1476,8 +1476,9 @@ build_scoped_method_call (exp, basetype, name, parms) ...@@ -1476,8 +1476,9 @@ build_scoped_method_call (exp, basetype, name, parms)
{ {
if (TREE_CODE (name) == BIT_NOT_EXPR) if (TREE_CODE (name) == BIT_NOT_EXPR)
{ {
tree type = get_aggr_from_typedef (TREE_OPERAND (name, 0), 1); tree type = get_aggr_from_typedef (TREE_OPERAND (name, 0), 0);
name = build_min_nt (BIT_NOT_EXPR, type); if (type)
name = build_min_nt (BIT_NOT_EXPR, type);
} }
name = build_min_nt (SCOPE_REF, basetype, name); name = build_min_nt (SCOPE_REF, basetype, name);
return build_min_nt (METHOD_CALL_EXPR, name, exp, parms, NULL_TREE); return build_min_nt (METHOD_CALL_EXPR, name, exp, parms, NULL_TREE);
......
...@@ -4484,7 +4484,11 @@ make_typename_type (context, name) ...@@ -4484,7 +4484,11 @@ make_typename_type (context, name)
fullname = name; fullname = name;
if (TREE_CODE (name) == TEMPLATE_ID_EXPR) if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
name = TREE_OPERAND (name, 0); {
name = TREE_OPERAND (name, 0);
if (TREE_CODE (name) == TEMPLATE_DECL)
name = TREE_OPERAND (fullname, 0) = DECL_NAME (name);
}
if (TREE_CODE (name) != IDENTIFIER_NODE) if (TREE_CODE (name) != IDENTIFIER_NODE)
my_friendly_abort (2000); my_friendly_abort (2000);
......
...@@ -908,7 +908,7 @@ yyprint (file, yychar, yylval) ...@@ -908,7 +908,7 @@ yyprint (file, yychar, yylval)
case SCSPEC: case SCSPEC:
case PRE_PARSED_CLASS_DECL: case PRE_PARSED_CLASS_DECL:
t = yylval.ttype; t = yylval.ttype;
if (TREE_CODE (t) == TYPE_DECL) if (TREE_CODE (t) == TYPE_DECL || TREE_CODE (t) == TEMPLATE_DECL)
{ {
fprintf (file, " `%s'", DECL_NAME (t)); fprintf (file, " `%s'", DECL_NAME (t));
break; break;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -3169,8 +3169,8 @@ nested_name_specifier: ...@@ -3169,8 +3169,8 @@ nested_name_specifier:
nested_name_specifier_1 nested_name_specifier_1
| nested_name_specifier nested_name_specifier_1 | nested_name_specifier nested_name_specifier_1
{ $$ = $2; } { $$ = $2; }
| nested_name_specifier TEMPLATE template_type SCOPE | nested_name_specifier explicit_template_type SCOPE
{ got_scope = $$ = complete_type (TREE_TYPE ($3)); } { got_scope = $$ = make_typename_type ($1, $2); }
; ;
/* Why the @#$%^& do type_name and notype_identifier need to be expanded /* Why the @#$%^& do type_name and notype_identifier need to be expanded
...@@ -3223,7 +3223,7 @@ typename_sub: ...@@ -3223,7 +3223,7 @@ typename_sub:
; ;
typename_sub0: typename_sub0:
typename_sub1 identifier typename_sub1 identifier %prec EMPTY
{ {
if (TREE_CODE_CLASS (TREE_CODE ($1)) == 't') if (TREE_CODE_CLASS (TREE_CODE ($1)) == 't')
$$ = make_typename_type ($1, $2); $$ = make_typename_type ($1, $2);
...@@ -3236,6 +3236,16 @@ typename_sub0: ...@@ -3236,6 +3236,16 @@ typename_sub0:
$$ = TREE_TYPE ($$); $$ = TREE_TYPE ($$);
} }
} }
| typename_sub1 template_type %prec EMPTY
{ $$ = TREE_TYPE ($2); }
| typename_sub1 identifier '<' template_arg_list_opt
template_close_bracket
{
$$ = build_min_nt (TEMPLATE_ID_EXPR, $2, $4);
$$ = make_typename_type ($1, $$);
}
| typename_sub1 explicit_template_type %prec EMPTY
{ $$ = make_typename_type ($1, $2); }
; ;
typename_sub1: typename_sub1:
......
...@@ -4502,7 +4502,9 @@ tsubst_copy (t, args, in_decl) ...@@ -4502,7 +4502,9 @@ tsubst_copy (t, args, in_decl)
tree base = tsubst_copy (TREE_OPERAND (name, 0), args, in_decl); tree base = tsubst_copy (TREE_OPERAND (name, 0), args, in_decl);
name = TREE_OPERAND (name, 1); name = TREE_OPERAND (name, 1);
name = tsubst_copy (TREE_OPERAND (name, 0), args, in_decl); name = tsubst_copy (TREE_OPERAND (name, 0), args, in_decl);
name = build1 (BIT_NOT_EXPR, NULL_TREE, TYPE_MAIN_VARIANT (name)); if (TREE_CODE (name) != IDENTIFIER_NODE)
name = TYPE_MAIN_VARIANT (name);
name = build1 (BIT_NOT_EXPR, NULL_TREE, name);
name = build_nt (SCOPE_REF, base, name); name = build_nt (SCOPE_REF, base, name);
} }
else else
......
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