From af08f6c451f2f49bc474b04455d351ac226b102f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 22 Apr 2011 15:43:44 +0200 Subject: Detect and diagnose incomplete pointed-to classes --- odb/relational/type-processor.cxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/odb/relational/type-processor.cxx b/odb/relational/type-processor.cxx index 379c4aa..97f4d85 100644 --- a/odb/relational/type-processor.cxx +++ b/odb/relational/type-processor.cxx @@ -639,6 +639,24 @@ namespace relational } } + // Make sure the pointed-to class is complete. + // + if (!COMPLETE_TYPE_P (c->tree_node ())) + { + os << m.file () << ":" << m.line () << ":" << m.column () << ": " + << "error: pointed-to class '" << c->fq_name () << "' " + << "is incomplete" << endl; + + os << c->file () << ":" << c->line () << ":" << c->column () << ": " + << "info: class '" << c->name () << "' is declared here" << endl; + + os << c->file () << ":" << c->line () << ":" << c->column () << ": " + << "info: consider including its definition with the " + << "--odb-prologue option" << endl; + + throw generation_failed (); + } + if (m.count ("not-null") && !kp.empty ()) { m.remove ("not-null"); -- cgit v1.1