Index: runtime/vm/parser.cc |
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc |
index e682207680984eeae35eb3ab5de4868482ba30e3..5c1bc446c6f8d008038b7e68547ce0bc79df2ade 100644 |
--- a/runtime/vm/parser.cc |
+++ b/runtime/vm/parser.cc |
@@ -13627,6 +13627,12 @@ AstNode* Parser::ParseNewOperator(Token::Kind op_kind) { |
} |
ASSERT(!constructor.IsNull()); |
+ // It is a compile time error to instantiate a const instance of an |
+ // abstract class. Factory methods are ok. |
+ if (is_const && type_class.is_abstract() && !constructor.IsFactory()) { |
+ ReportError(new_pos, "cannot instantiate abstract class"); |
+ } |
+ |
// It is ok to call a factory method of an abstract class, but it is |
// a dynamic error to instantiate an abstract class. |
if (type_class.is_abstract() && !constructor.IsFactory()) { |