aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/except.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2013-05-08 23:58:07 -0400
committerJason Merrill <jason@gcc.gnu.org>2013-05-08 23:58:07 -0400
commit785b887ee8ef5c48ffe99f2a9c5bb9612f98423f (patch)
tree06c055f14e319afdc2ae32be2e5769e4ba286913 /gcc/cp/except.c
parent7d5e76c8de1b6c4b2ae5576ab909dc9e580b216b (diff)
downloadgcc-785b887ee8ef5c48ffe99f2a9c5bb9612f98423f.zip
gcc-785b887ee8ef5c48ffe99f2a9c5bb9612f98423f.tar.gz
gcc-785b887ee8ef5c48ffe99f2a9c5bb9612f98423f.tar.bz2
except.c (is_admissible_throw_operand_or_catch_parameter): Check variably_modified_type_p.
* except.c (is_admissible_throw_operand_or_catch_parameter): Check variably_modified_type_p. (expand_start_catch_block): Mark the typeinfo used here. * semantics.c (finish_handler_parms): Not here. * error.c (dump_type_suffix): Try harder on VLA length. From-SVN: r198732
Diffstat (limited to 'gcc/cp/except.c')
-rw-r--r--gcc/cp/except.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index b762a51..be003d2 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -490,6 +490,7 @@ expand_start_catch_block (tree decl)
decl = error_mark_node;
type = prepare_eh_type (TREE_TYPE (decl));
+ mark_used (eh_type_info (type));
}
else
type = NULL_TREE;
@@ -982,6 +983,16 @@ is_admissible_throw_operand_or_catch_parameter (tree t, bool is_throw)
"reference type %qT", type);
return false;
}
+ else if (variably_modified_type_p (type, NULL_TREE))
+ {
+ if (is_throw)
+ error ("cannot throw expression of type %qT because it involves "
+ "types of variable size", type);
+ else
+ error ("cannot catch type %qT because it involves types of "
+ "variable size", type);
+ return false;
+ }
return true;
}