This commit is contained in:
parent
fd3befe60a
commit
53cab34484
|
@ -4311,7 +4311,13 @@ void Function::addArguments(const SymbolDatabase *symbolDatabase, const Scope *s
|
||||||
initArgCount++;
|
initArgCount++;
|
||||||
if (tok->strAt(1) == "[") {
|
if (tok->strAt(1) == "[") {
|
||||||
const Token* lambdaStart = tok->next();
|
const Token* lambdaStart = tok->next();
|
||||||
tok = type == eLambda ? findLambdaEndTokenWithoutAST(lambdaStart) : findLambdaEndToken(lambdaStart);
|
if (type == eLambda)
|
||||||
|
tok = findLambdaEndTokenWithoutAST(lambdaStart);
|
||||||
|
else {
|
||||||
|
tok = findLambdaEndToken(lambdaStart);
|
||||||
|
if (!tok)
|
||||||
|
tok = findLambdaEndTokenWithoutAST(lambdaStart);
|
||||||
|
}
|
||||||
if (!tok)
|
if (!tok)
|
||||||
throw InternalError(lambdaStart, "Analysis failed (lambda not recognized). If the code is valid then please report this failure.", InternalError::INTERNAL);
|
throw InternalError(lambdaStart, "Analysis failed (lambda not recognized). If the code is valid then please report this failure.", InternalError::INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -246,6 +246,7 @@ private:
|
||||||
TEST_CASE(functionArgs17);
|
TEST_CASE(functionArgs17);
|
||||||
TEST_CASE(functionArgs18); // #10376
|
TEST_CASE(functionArgs18); // #10376
|
||||||
TEST_CASE(functionArgs19); // #10376
|
TEST_CASE(functionArgs19); // #10376
|
||||||
|
TEST_CASE(functionArgs20);
|
||||||
|
|
||||||
TEST_CASE(functionImplicitlyVirtual);
|
TEST_CASE(functionImplicitlyVirtual);
|
||||||
|
|
||||||
|
@ -2707,6 +2708,17 @@ private:
|
||||||
ASSERT_EQUALS(3, func->argCount());
|
ASSERT_EQUALS(3, func->argCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void functionArgs20() { // #11769
|
||||||
|
const char code[] = "void f(void *(*g)(void *) = [](void *p) { return p; }) {}";
|
||||||
|
GET_SYMBOL_DB(code);
|
||||||
|
ASSERT(db != nullptr);
|
||||||
|
const Scope *scope = db->functionScopes.front();
|
||||||
|
const Function *func = scope->function;
|
||||||
|
ASSERT_EQUALS(1, func->argCount());
|
||||||
|
const Variable* arg = func->getArgumentVar(0);
|
||||||
|
TODO_ASSERT(arg->hasDefault());
|
||||||
|
}
|
||||||
|
|
||||||
void functionImplicitlyVirtual() {
|
void functionImplicitlyVirtual() {
|
||||||
GET_SYMBOL_DB("class base { virtual void f(); };\n"
|
GET_SYMBOL_DB("class base { virtual void f(); };\n"
|
||||||
"class derived : base { void f(); };\n"
|
"class derived : base { void f(); };\n"
|
||||||
|
|
Loading…
Reference in New Issue