diff options
Diffstat (limited to 'odb/processor.cxx')
-rw-r--r-- | odb/processor.cxx | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/odb/processor.cxx b/odb/processor.cxx index 291dcd3..a6f18e0 100644 --- a/odb/processor.cxx +++ b/odb/processor.cxx @@ -1313,6 +1313,9 @@ namespace } } + bool poly (polymorphic (*c)); + bool abst (abstract (*c)); + // Make sure the pointed-to class is complete. // if (!c->complete ()) @@ -1334,7 +1337,7 @@ namespace // Make sure the pointed-to class is not reuse-abstract. // - if (abstract (*c) && !polymorphic (*c)) + if (abst && !poly) { os << m.file () << ":" << m.line () << ":" << m.column () << ": " << "error: pointed-to class '" << class_fq_name (*c) << "' " @@ -1362,6 +1365,23 @@ namespace throw operation_failed (); } + // Make sure the pointed-to class has a default ctor. Since we will + // use database::load() in the generated code, lack of a default ctor + // will lead to uncompilable generated code. Poly-abstract is Ok. + // + if (!c->default_ctor () && !(abst && poly)) + { + os << m.file () << ":" << m.line () << ":" << m.column () << ": " + << "error: pointed-to class '" << class_fq_name (*c) << "' " + << "has no default constructor" << endl; + + os << c->file () << ":" << c->line () << ":" << c->column () << ": " + << "info: class '" << class_name (*c) << "' is defined here" + << endl; + + throw operation_failed (); + } + // See if this is the inverse side of a bidirectional relationship. // If so, then resolve the member and cache it in the context. // |