pt.c (tsubst_expr): Set DECL_TEMPLATE_INSTANTIATED for a catch paramter.

* pt.c (tsubst_expr): Set DECL_TEMPLATE_INSTANTIATED for a catch
	paramter.

	* semantics.c (expand_stmt): Don't pretend to have asmspecs for
	local statics if we don't really have them.

	* ir.texi: Improve documentation for STMT_EXPR.  Describe
	CLEANUP_POINT_EXPR.

From-SVN: r29863
This commit is contained in:
Mark Mitchell 1999-10-08 05:42:36 +00:00 committed by Mark Mitchell
parent 7d00586921
commit f8191e640d
6 changed files with 85 additions and 4 deletions

View File

@ -1,3 +1,14 @@
1999-10-07 Mark Mitchell <mark@codesourcery.com>
* pt.c (tsubst_expr): Set DECL_TEMPLATE_INSTANTIATED for a catch
paramter.
* semantics.c (expand_stmt): Don't pretend to have asmspecs for
local statics if we don't really have them.
* ir.texi: Improve documentation for STMT_EXPR. Describe
CLEANUP_POINT_EXPR.
1999-10-07 Jason Merrill <jason@yorick.cygnus.com>
* class.c (build_vtable_entry_ref): Use finish_asm_stmt.

View File

@ -1475,6 +1475,7 @@ The @code{WHILE_BODY} is the body of the loop.
@tindex BIND_EXPR
@tindex LOOP_EXPR
@tindex EXIT_EXPR
@tindex CLEANUP_POINT_EXPR
@tindex ARRAY_REF
The internal representation for expressions is for the most part quite
@ -1824,7 +1825,19 @@ expression would normally appear. The @code{STMT_EXPR} node represents
such an expression. The @code{STMT_EXPR_STMT} gives the statement
contained in the expression; this is always a @code{COMPOUND_STMT}. The
value of the expression is the value of the last sub-statement in the
@code{COMPOUND_STMT}.
@code{COMPOUND_STMT}. More precisely, the value is the value computed
by the last @code{EXPR_STMT} in the outermost scope of the
@code{COMPOUND_STMT}. For example, in:
@example
(@{ 3; @})
@end example
the value is @code{3} while in:
@example
(@{ if (x) { 3; } @})
@end example
(represented by a nested @code{COMPOUND_STMT}), there is no value. If
the @code{STMT_EXPR} does not yield a value, it's type will be
@code{void}.
@item BIND_EXPR
These nodes represent local blocks. The first operand is a list of
@ -1844,6 +1857,12 @@ These nodes represent conditional exits from the nearest enclosing
non-zero, then the loop should be exited. An @code{EXIT_EXPR} will only
appear within a @code{LOOP_EXPR}.
@item CLEANUP_POINT_EXPR
These nodes represent full-expressions. The single oeprand is an
expression to evaluate. Any destructor calls engendered by the creation
of temporaries during the evaluation of that expression should be
performed immediately after the expression is evaluated.
@item CONSTRUCTOR
These nodes represent the brace-enclosed initializers for a structure or
array. The first operand is reserved for use by the back-end. The

View File

@ -7424,6 +7424,10 @@ tsubst_expr (t, args, complain, in_decl)
{
decl = DECL_STMT_DECL (HANDLER_PARMS (t));
decl = tsubst (decl, args, complain, in_decl);
/* Prevent instantiate_decl from trying to instantiate
this variable. We've already done all that needs to be
done. */
DECL_TEMPLATE_INSTANTIATED (decl) = 1;
}
else
decl = NULL_TREE;

View File

@ -2301,9 +2301,21 @@ expand_stmt (t)
DECL_ANON_UNION_ELEMS (decl));
}
else if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl))
rest_of_decl_compilation
(decl, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)),
/*top_level=*/0, /*at_end=*/0);
{
const char *asmspec = NULL;
if (DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl))
{
/* The only way this situaton can occur is if the
user specified a name for this DECL using the
`attribute' syntax. */
asmspec = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
DECL_ASSEMBLER_NAME (decl) = DECL_NAME (decl);
}
rest_of_decl_compilation (decl, asmspec,
/*top_level=*/0, /*at_end=*/0);
}
resume_momentary (i);
}

View File

@ -0,0 +1,18 @@
// Build don't link:
// Origin: Mark Mitchell <mark@codesourcery.com>
struct S
{
int i;
};
template <class T>
void f ()
{
try {
} catch (S& s) {
s.i = 3;
}
}
template void f<int>();

View File

@ -0,0 +1,17 @@
// Build don't link:
// Origin: Ulrich Drepper <drepper@cygnus.com>
struct st
{
int a, b, c, d;
};
void g ()
{
static const st i = { 0,1,2,3 };
}
void h ()
{
static const st i = { 0,1,2,3 };
}