Ticket #6835: Don't get confused by parentheses while detecting template parameter default values.
This commit is contained in:
parent
25d9ebedd8
commit
af1b0cfddf
|
@ -572,6 +572,11 @@ void TemplateSimplifier::useDefaultArgumentValues(const std::list<Token *> &temp
|
|||
continue;
|
||||
}
|
||||
|
||||
if (tok->str() == "(") { // Ticket #6835
|
||||
tok = tok->link();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tok->str() == "<" && templateParameters(tok))
|
||||
++templateParmDepth;
|
||||
|
||||
|
|
|
@ -140,6 +140,7 @@ private:
|
|||
TEST_CASE(garbageCode98);
|
||||
TEST_CASE(garbageCode99);
|
||||
TEST_CASE(garbageCode100);
|
||||
TEST_CASE(garbageCode101); // #6835
|
||||
|
||||
TEST_CASE(garbageValueFlow);
|
||||
TEST_CASE(garbageSymbolDatabase);
|
||||
|
@ -791,6 +792,13 @@ private:
|
|||
checkCode("( ) { ( i< ) } int foo ( ) { int i ; ( for ( i => 1 ) ; ) }");
|
||||
}
|
||||
|
||||
void garbageCode101() { // #6835
|
||||
// Reported case
|
||||
checkCode("template < class , =( , int) X = 1 > struct A { } ( ) { = } [ { } ] ( ) { A < void > 0 }");
|
||||
// Reduced case
|
||||
checkCode("template < class =( , ) X = 1> struct A {}; A<void> a;");
|
||||
}
|
||||
|
||||
void garbageValueFlow() {
|
||||
// #6089
|
||||
const char* code = "{} int foo(struct, x1, struct x2, x3, int, x5, x6, x7)\n"
|
||||
|
|
Loading…
Reference in New Issue