aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-08-18 17:46:03 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-08-18 17:46:03 +0200
commit601ac3009abc89685d94d03dcdd8e20ab0282b2f (patch)
treec9284eacd1c4c0fd3226acb0d5de277a37c85781
parent39f2f6b22984b5a322c3513dc1325018a47fe610 (diff)
Detect container of containers via composite value
-rw-r--r--odb/validator.cxx47
1 files changed, 47 insertions, 0 deletions
diff --git a/odb/validator.cxx b/odb/validator.cxx
index 9b95b31..acae34a 100644
--- a/odb/validator.cxx
+++ b/odb/validator.cxx
@@ -1271,6 +1271,53 @@ namespace
//
if (class_* comp = composite_wrapper (t))
verify_composite_location (*comp, s, m);
+
+ // Check that containers with composite value element types don't have
+ // any nested containers.
+ //
+ if (semantics::type* c = container (m))
+ {
+ class_* vt (0);
+ class_* kt (0);
+
+ switch (container_kind (*c))
+ {
+ case ck_map:
+ case ck_multimap:
+ {
+ kt = composite_wrapper (container_kt (m));
+ // Fall through.
+ }
+ default:
+ {
+ vt = composite_wrapper (container_vt (m));
+ }
+ }
+
+ if (vt != 0 && has_a (*vt, test_container))
+ {
+ os << m.file () << ":" << m.line () << ":" << m.column () << ": "
+ << "error: containers of containers not supported" << endl;
+
+ os << vt->file () << ":" << vt->line () << ":" << vt->column ()
+ << ": info: composite element value " << class_fq_name (*vt)
+ << " contains container(s)" << endl;
+
+ valid_ = false;
+ }
+
+ if (kt != 0 && has_a (*kt, test_container))
+ {
+ os << m.file () << ":" << m.line () << ":" << m.column () << ": "
+ << "error: containers of containers not supported" << endl;
+
+ os << kt->file () << ":" << kt->line () << ":" << kt->column ()
+ << ": info: composite element key " << class_fq_name (*kt)
+ << " contains container(s)" << endl;
+
+ valid_ = false;
+ }
+ }
}
bool& valid_;