summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/class.c6
2 files changed, 9 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3b59f2146a6..1bf287aecee 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2013-07-13 Jason Merrill <jason@redhat.com>
+ PR c++/57793
+ * class.c (layout_class_type): Check for too-large class.
+
* call.c (can_convert): Allow user-defined conversions.
(can_convert_standard): New.
* cp-tree.h: Declare it.
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index e5166324e4c..45652a68dbe 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -6237,6 +6237,12 @@ layout_class_type (tree t, tree *virtuals_p)
/* Let the back end lay out the type. */
finish_record_layout (rli, /*free_p=*/true);
+ if (TYPE_SIZE_UNIT (t)
+ && TREE_CODE (TYPE_SIZE_UNIT (t)) == INTEGER_CST
+ && !TREE_OVERFLOW (TYPE_SIZE_UNIT (t))
+ && !valid_constant_size_p (TYPE_SIZE_UNIT (t)))
+ error ("type %qT is too large", t);
+
/* Warn about bases that can't be talked about due to ambiguity. */
warn_about_ambiguous_bases (t);