From 36387818eca6da75ce26a5143b7f87e88f7c8cdc Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 10 Mar 2011 09:20:41 +0200 Subject: Do sensible things if traversers are copied --- cutl/compiler/traversal.hxx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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*> traversers; - typedef std::map map_type; + + struct map_type: std::map + { + 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 () {} + 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; -- cgit v1.1