Fixed #5465 (crash: AST doesnt produce good output for 'class C:public :🅰️:b<c>{..};')
This commit is contained in:
parent
42a3aaa4cf
commit
a1d9873558
|
@ -443,7 +443,8 @@ static void compileTerm(Token *& tok, std::stack<Token*> &op)
|
||||||
} else if (tok->next() && tok->next()->str() == "<" && tok->next()->link() && !templatefunc) {
|
} else if (tok->next() && tok->next()->str() == "<" && tok->next()->link() && !templatefunc) {
|
||||||
op.push(tok);
|
op.push(tok);
|
||||||
tok = tok->next()->link()->next();
|
tok = tok->next()->link()->next();
|
||||||
compileTerm(tok,op);
|
if (!Token::simpleMatch(tok, "{"))
|
||||||
|
compileTerm(tok,op);
|
||||||
} else if (!Token::Match(tok->next(), "(|[") && !templatefunc) {
|
} else if (!Token::Match(tok->next(), "(|[") && !templatefunc) {
|
||||||
op.push(tok);
|
op.push(tok);
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
|
|
|
@ -10061,7 +10061,8 @@ private:
|
||||||
|
|
||||||
static std::string testAst(const char code[]) {
|
static std::string testAst(const char code[]) {
|
||||||
// tokenize given code..
|
// tokenize given code..
|
||||||
TokenList tokenList(NULL);
|
const Settings settings;
|
||||||
|
TokenList tokenList(&settings);
|
||||||
std::istringstream istr(code);
|
std::istringstream istr(code);
|
||||||
if (!tokenList.createTokens(istr,"test.cpp"))
|
if (!tokenList.createTokens(istr,"test.cpp"))
|
||||||
return "ERROR";
|
return "ERROR";
|
||||||
|
@ -10193,6 +10194,8 @@ private:
|
||||||
testAst("extern int for_each_commit_graft(int (*)(int*), void *);"); // don't crash
|
testAst("extern int for_each_commit_graft(int (*)(int*), void *);"); // don't crash
|
||||||
testAst("for (;;) {}"); // don't crash
|
testAst("for (;;) {}"); // don't crash
|
||||||
ASSERT_EQUALS("xsizeofvoid(=", testAst("x=sizeof(void*)"));
|
ASSERT_EQUALS("xsizeofvoid(=", testAst("x=sizeof(void*)"));
|
||||||
|
|
||||||
|
ASSERT_EQUALS("publica::b::", testAst("class C : public ::a::b<bool> { };"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void asttemplate() const { // uninstantiated templates will have <,>,etc..
|
void asttemplate() const { // uninstantiated templates will have <,>,etc..
|
||||||
|
|
Loading…
Reference in New Issue