diff options
author | Nikolai Kosjar <nikolai.kosjar@digia.com> | 2014-07-10 11:24:45 +0200 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@digia.com> | 2014-07-10 12:12:46 +0200 |
commit | 33a80e56cc9d1081206b3310dde1bd8524b9ee24 (patch) | |
tree | 5a34a115cb95b139f1c46f83d8513be9ef482944 /src/libs/3rdparty/cplusplus/Bind.cpp | |
parent | 65461ab033a3d8ba10ebfa6c1b13ee8285eb1ed1 (diff) |
C++: Fix return type of lambda
Relying on "_type" for the lambda was wrong.
In case of the bug report the return type of the lambda happened to be
the template class. Because of that Clone never stopped cloning.
Change-Id: I377d12e6a8278198abd1488fbdbc89b4157c1357
Task-number: QTCREATORBUG-12631
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/libs/3rdparty/cplusplus/Bind.cpp')
-rw-r--r-- | src/libs/3rdparty/cplusplus/Bind.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libs/3rdparty/cplusplus/Bind.cpp b/src/libs/3rdparty/cplusplus/Bind.cpp index e6245eb036..4f7be860df 100644 --- a/src/libs/3rdparty/cplusplus/Bind.cpp +++ b/src/libs/3rdparty/cplusplus/Bind.cpp @@ -1095,20 +1095,24 @@ Function *Bind::lambdaDeclarator(LambdaDeclaratorAST *ast) Function *fun = control()->newFunction(0, 0); fun->setStartOffset(tokenAt(ast->firstToken()).utf16charsBegin()); fun->setEndOffset(tokenAt(ast->lastToken() - 1).utf16charsEnd()); + + FullySpecifiedType type; if (ast->trailing_return_type) - _type = this->trailingReturnType(ast->trailing_return_type, _type); - fun->setReturnType(_type); + type = this->trailingReturnType(ast->trailing_return_type, type); ast->symbol = fun; // unsigned lparen_token = ast->lparen_token; - FullySpecifiedType type; this->parameterDeclarationClause(ast->parameter_declaration_clause, ast->lparen_token, fun); // unsigned rparen_token = ast->rparen_token; for (SpecifierListAST *it = ast->attributes; it; it = it->next) { type = this->specifier(it->value, type); } // unsigned mutable_token = ast->mutable_token; - _type = this->exceptionSpecification(ast->exception_specification, type); + type = this->exceptionSpecification(ast->exception_specification, type); + + if (!type.isValid()) + type.setType(control()->voidType()); + fun->setReturnType(type); return fun; } |