• Orgad Shaneh's avatar
    C++: Limit template instantiation depth · 0bcddcd0
    Orgad Shaneh authored
    
    
    A recursive template generates infinite expansions.
    
    Consider the following example:
    
    template <class R1>
    struct Base
    {
    };
    
    template<typename R>
    struct Derived :
      Base<
        typename Derived<typename Base<R>::type>::type,
        typename Derived<typename Base<R>::type>::type
      >::type
    {};
    
    R is instantiated as Base<R>::type, which causes another
    instantiation of R into Base<Base<R>> etc...
    
    This is not a solution, but a workaround.
    
    Task-number: QTCREATORBUG-15141
    Change-Id: Ib04f70275e07919e2cb6c7fb61a2045bd52f4a7d
    Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@theqtcompany.com>
    0bcddcd0
LookupContext.cpp 68.5 KB