Ticket #5816: Properly handle template'd template parameters in enum initializers.
This commit is contained in:
parent
d299cae5ef
commit
fcff8d39d9
|
@ -7572,7 +7572,9 @@ void Tokenizer::simplifyEnum()
|
|||
endtoken = endtoken->next();
|
||||
if (Token::Match(endtoken, "*|,|::|typename"))
|
||||
endtoken = endtoken->next();
|
||||
} while (Token::Match(endtoken, "%var%|%num% *| [,>]") || Token::Match(endtoken, "%var%|%num% :: %any%"));
|
||||
if (endtoken->str() == "<" && TemplateSimplifier::templateParameters(endtoken))
|
||||
endtoken = endtoken->findClosingBracket();
|
||||
} while (Token::Match(endtoken, "%var%|%num% *| [,>]") || Token::Match(endtoken, "%var%|%num% ::|< %any%"));
|
||||
if (endtoken->str() == ">") {
|
||||
enumValueEnd = endtoken;
|
||||
if (Token::simpleMatch(endtoken, "> ( )"))
|
||||
|
|
|
@ -2414,6 +2414,12 @@ private:
|
|||
"enum { e = sizeof(A<int, int>) }; "
|
||||
"template <class T, class U> struct B {};");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
tok("template<class T, class U> struct A { static const int value = 0; }; "
|
||||
"template<class T> struct B { typedef int type; }; "
|
||||
"template <class T> struct C { "
|
||||
" enum { value = A<typename B<T>::type, int>::value }; "
|
||||
"};");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void template_default_parameter() {
|
||||
|
|
Loading…
Reference in New Issue