aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-03-10 09:20:41 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-03-10 09:20:41 +0200
commit36387818eca6da75ce26a5143b7f87e88f7c8cdc (patch)
treeab4eae5e7823e6796b1f3892e002d69e509d50cb
parentab5a37ec04dbf27899f6303fa22a5c145442fb92 (diff)
Do sensible things if traversers are copied
-rw-r--r--cutl/compiler/traversal.hxx19
1 files changed, 18 insertions, 1 deletions
diff --git a/cutl/compiler/traversal.hxx b/cutl/compiler/traversal.hxx
index 44fd3e6..58e8896 100644
--- a/cutl/compiler/traversal.hxx
+++ b/cutl/compiler/traversal.hxx
@@ -36,7 +36,19 @@ namespace cutl
{
public:
typedef std::vector<traverser<B>*> traversers;
- typedef std::map<type_id, traversers> map_type;
+
+ struct map_type: std::map<type_id, traversers>
+ {
+ map_type () {}
+
+ // Don't copy traverser maps. We do it here instead of in
+ // traverser_map to pacify GCC's -Wextra insisting we must
+ // explicitly initialize virtual bases in copy constructor.
+ //
+ map_type (map_type const&): std::map<type_id, traversers> () {}
+ map_type& operator= (map_type const&) {return *this;}
+ };
+
typedef typename map_type::const_iterator iterator;
iterator
@@ -76,6 +88,11 @@ namespace cutl
add (typeid (type), *this);
}
+ traverser_impl (traverser_impl const&)
+ {
+ add (typeid (type), *this);
+ }
+
virtual void
traverse (type&) = 0;