forked from qt-creator/qt-creator
C++: Limit template instantiation depth
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: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
a27cd12538
commit
0bcddcd014
@@ -209,6 +209,7 @@ private:
|
||||
LookupScope *_globalNamespace;
|
||||
LookupScope *_currentLookupScope;
|
||||
bool _expandTemplates;
|
||||
int _depth;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT LookupContext
|
||||
|
||||
Reference in New Issue
Block a user