summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog11
-rw-r--r--gcc/cp/ir.texi21
-rw-r--r--gcc/cp/pt.c4
-rw-r--r--gcc/cp/semantics.c18
-rw-r--r--gcc/testsuite/g++.old-deja/g++.eh/tmpl6.C18
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/static9.C17
6 files changed, 85 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 45bde3958dd..97f16983f3f 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/ir.texi b/gcc/cp/ir.texi
index dd7a5699851..fd21cf3beaf 100644
--- a/gcc/cp/ir.texi
+++ b/gcc/cp/ir.texi
@@ -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
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index b4b9ba9b530..027e04a4df7 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -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;
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index da17d3b3a01..5cdeb07baca 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -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);
}
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/tmpl6.C b/gcc/testsuite/g++.old-deja/g++.eh/tmpl6.C
new file mode 100644
index 00000000000..b5b79c8cbc4
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.eh/tmpl6.C
@@ -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>();
diff --git a/gcc/testsuite/g++.old-deja/g++.other/static9.C b/gcc/testsuite/g++.old-deja/g++.other/static9.C
new file mode 100644
index 00000000000..e1bb50b3627
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/static9.C
@@ -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 };
+}