Fixed #3130 (Tokenizer: Doesn't instantiate recursive template correctly)
This commit is contained in:
parent
fa31ebf88e
commit
f116de678e
|
@ -1268,7 +1268,7 @@ bool TemplateSimplifier::simplifyTemplateInstantiations(
|
|||
amountOftemplateInstantiations = templateInstantiations.size();
|
||||
simplifyCalculations(tokenlist.front());
|
||||
++recursiveCount;
|
||||
if (recursiveCount > 100) {
|
||||
if (recursiveCount > 1) {
|
||||
// bail out..
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -436,7 +436,7 @@ private:
|
|||
"int main ( ) "
|
||||
"{ a<2> ( ) ; return 0 ; } "
|
||||
"void a<2> ( ) { a<1> ( ) ; } "
|
||||
"void a<1> ( ) { a<0> ( ) ; }";
|
||||
"void a<1> ( ) { a < 0 > ( ) ; }";
|
||||
|
||||
ASSERT_EQUALS(expected, tok(code));
|
||||
}
|
||||
|
@ -1022,7 +1022,7 @@ private:
|
|||
"{\n"
|
||||
" enum {value = !type_equal<T, typename Unconst<T>::type>::value };\n"
|
||||
"};";
|
||||
const char expected1[]="template < class T > struct Unconst { } ; template < class T > struct type_equal<T,T> { } ; template < class T > struct template_is_const { } ; struct type_equal<T,T> { } ; struct Unconst<constT*const> { } ; struct Unconst<constT&*const> { } ; struct Unconst<T*const*const> { } ; struct Unconst<T*const> { } ; struct Unconst<T*const> { } ; struct Unconst<T*const> { } ; struct Unconst<constT&><};template<T> { } ; struct Unconst<constT><};template<T> { } ;";
|
||||
const char expected1[]="template < class T > struct type_equal<T,T> { } ; template < class T > struct template_is_const { } ; struct type_equal<T,T> { } ; struct Unconst<constT*const> { } ; struct Unconst<constT&*const> { } ; struct Unconst<constT&><};template<T> { } ; struct Unconst<constT><};template<T> { } ; struct Unconst<T*const> { } ; struct Unconst<constT*const> { } ; struct Unconst<constT&*const> { } ;";
|
||||
ASSERT_EQUALS(expected1, tok(code1));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue