Fixed #4211 (Tokenizer::simplifyVarDecl: Improved handling of >> in templates)
This commit is contained in:
parent
3ff792560f
commit
1f7d9ca22c
|
@ -5042,11 +5042,17 @@ void Tokenizer::simplifyVarDecl(bool only_k_r_fpar)
|
||||||
if (tok3->str() == "<" && !parens) {
|
if (tok3->str() == "<" && !parens) {
|
||||||
++indentlevel;
|
++indentlevel;
|
||||||
} else if (tok3->str() == ">" && !parens) {
|
} else if (tok3->str() == ">" && !parens) {
|
||||||
if (!indentlevel) {
|
if (indentlevel == 0) {
|
||||||
tok2 = tok3->next();
|
tok2 = tok3->next();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
--indentlevel;
|
--indentlevel;
|
||||||
|
} else if (tok3->str() == ">>" && !parens) {
|
||||||
|
if (indentlevel <= 1U) {
|
||||||
|
tok2 = tok3->next();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
indentlevel -= 2;
|
||||||
} else if (tok3->str() == "(") {
|
} else if (tok3->str() == "(") {
|
||||||
++parens;
|
++parens;
|
||||||
} else if (tok3->str() == ")") {
|
} else if (tok3->str() == ")") {
|
||||||
|
|
|
@ -325,6 +325,7 @@ private:
|
||||||
TEST_CASE(vardecl19);
|
TEST_CASE(vardecl19);
|
||||||
TEST_CASE(vardecl20); // #3700 - register const int H = 0;
|
TEST_CASE(vardecl20); // #3700 - register const int H = 0;
|
||||||
TEST_CASE(vardecl21); // #4042 - a::b const *p = 0;
|
TEST_CASE(vardecl21); // #4042 - a::b const *p = 0;
|
||||||
|
TEST_CASE(vardecl22); // #4211 - segmentation fault
|
||||||
TEST_CASE(vardecl_stl_1);
|
TEST_CASE(vardecl_stl_1);
|
||||||
TEST_CASE(vardecl_stl_2);
|
TEST_CASE(vardecl_stl_2);
|
||||||
TEST_CASE(vardecl_template_1);
|
TEST_CASE(vardecl_template_1);
|
||||||
|
@ -5107,6 +5108,10 @@ private:
|
||||||
, tokenizeAndStringify(code));
|
, tokenizeAndStringify(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void vardecl22() { // #4211 - segmentation fault
|
||||||
|
tokenizeAndStringify("A<B<C<int>> >* p = 0;");
|
||||||
|
}
|
||||||
|
|
||||||
void volatile_variables() {
|
void volatile_variables() {
|
||||||
const char code[] = "volatile int a=0;\n"
|
const char code[] = "volatile int a=0;\n"
|
||||||
"volatile int b=0;\n"
|
"volatile int b=0;\n"
|
||||||
|
|
Loading…
Reference in New Issue