http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59882
--- Comment #2 from David Kredba <nheghathivhistha at gmail dot com> --- c-reduce at --sllooww> namespace std { template < class, class > struct pair; template < typename _Iterator > struct iterator_traits { typedef typename _Iterator::value_type value_type; }; template < typename > class allocator { public: template < typename > struct rebind { typedef allocator other; }; }; template < typename > struct less { }; template < typename > struct _Select1st; } namespace __gnu_cxx { template < typename _Alloc > struct __alloc_traits { template < typename _Tp > struct rebind { typedef typename _Alloc::template rebind < _Tp >::other other; }; }; } namespace std { template < typename > struct _Rb_tree_node; template < typename, typename _Val, typename, typename _Compare, typename _Alloc = allocator < _Val > >class _Rb_tree { typedef typename __gnu_cxx::__alloc_traits < _Alloc >::template rebind < _Rb_tree_node < _Val > >::other _Node_allocator; typedef _Alloc allocator_type; template < typename _Key_compare > struct _Rb_tree_impl { _Rb_tree_impl (_Key_compare, _Node_allocator); }; _Rb_tree_impl < _Compare > _M_impl; public: _Rb_tree (_Compare __comp, allocator_type __a):_M_impl (__comp, __a) { } }; template < typename _Key, typename _Tp, typename _Compare = less < _Key >, typename _Alloc = allocator < pair < _Key, _Tp > > >class map { public: typedef _Key key_type; typedef pair < _Key, _Tp > value_type; typedef _Compare key_compare; typedef _Alloc allocator_type; typedef _Rb_tree < key_type, value_type, _Select1st < value_type >, key_compare > _Rep_type; _Rep_type _M_t; map (_Compare __comp, allocator_type __a = allocator_type ()):_M_t (__comp, __a) { } }; template < typename _Tp > struct _List_iterator { typedef _Tp value_type; }; template < typename _Tp > class list { public: typedef _List_iterator < _Tp > iterator; }; } namespace Cult { namespace Types { namespace Fundamental { typedef void Void; typedef int WideChar; } using Fundamental::Void; using Fundamental::WideChar; } namespace { template < typename I > class IteratorAdapter { public: typedef typename std::iterator_traits < I >::value_type Value; }; } namespace Types { template < typename > class StringTemplate; typedef StringTemplate < WideChar > WideString; } namespace Containers { template < typename K, typename T > class Map:std::map < K, T > { typedef std::map < K, T > Base; typedef typename Base::key_compare Compare; public: Map (Compare comp = Compare ()):Base (comp) { } }; template < typename T > class List { typedef std::list < T > Base; public: typedef IteratorAdapter < typename Base::iterator > Iterator; }; } } namespace { using namespace Cult::Types; } namespace XSDFrontend { namespace SemanticGraph { namespace Bits { template < typename > struct strip_pointer; template < typename X > struct strip_pointer <X * > { typedef X Type; }; template < typename I > struct PointerIterator { typedef typename strip_pointer < typename I::Value >::Type Reference; Reference operator* (); }; } class Edge { }; class Node; class Names:public Edge { }; class Scope { typedef Cult::Containers::List < Names * >NamesList; public: typedef Bits::PointerIterator < NamesList::Iterator > NamesIterator; }; class Type; class Complex:public Scope { }; } } namespace FrontendElements { namespace Traversal { template < typename > class TraverserBase { }; template < typename X > class DispatcherBase { public: virtual Void dispatch (X); }; template < typename X > class Dispatcher:public DispatcherBase < X > { }; } } namespace XSDFrontend { namespace Traversal { namespace Bits { using FrontendElements::Traversal::TraverserBase; using FrontendElements::Traversal::DispatcherBase; using FrontendElements::Traversal::Dispatcher; } typedef Bits::DispatcherBase < SemanticGraph::Edge > EdgeDispatcherBase; struct EdgeBase:virtual Bits::Dispatcher < SemanticGraph::Edge >, Bits::Dispatcher < SemanticGraph::Node > { }; template < typename > struct Edge:Bits::TraverserBase < SemanticGraph::Edge >, EdgeBase { }; struct Names:Edge < Names > { }; template < typename T > struct ScopeTemplate { template < typename > Void names (T, EdgeDispatcherBase & d) { typename T::NamesIterator b; d.dispatch (*b); } Void names (T s, EdgeDispatcherBase & d) { names < ScopeTemplate > (s, d); } }; struct Complex:ScopeTemplate < SemanticGraph::Complex > { }; } typedef WideString String; class Context { }; namespace Parser { namespace { typedef Cult::Containers::Map < SemanticGraph::Type, String > TypeInstanceMap; struct BaseType { BaseType (Context); }; struct ArgList:Traversal::Complex { ArgList (Context, TypeInstanceMap) { } virtual Void traverse (SemanticGraph::Complex c) { names (c, names_); } TypeInstanceMap map_; Traversal::Names names_; }; struct ParserConnect:Context { ParserConnect (Context c, TypeInstanceMap):base_ (c) { ArgList (*this, map_); } TypeInstanceMap map_; BaseType base_; }; } Void generate_driver_source (Context ctx) { TypeInstanceMap map; ParserConnect (ctx, map); } } }