aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/class.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r--gcc/cp/class.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 938d522..dc2c509 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -1268,6 +1268,10 @@ check_bases (tree t,
gcc_assert (COMPLETE_TYPE_P (basetype));
+ if (CLASSTYPE_FINAL (basetype))
+ error ("cannot derive from %<final%> base %qT in derived type %qT",
+ basetype, t);
+
/* If any base class is non-literal, so is the derived class. */
if (!CLASSTYPE_LITERAL_P (basetype))
CLASSTYPE_LITERAL_P (t) = false;