diff options
author | Erik Verbruggen <erik.verbruggen@nokia.com> | 2010-09-15 16:43:04 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@nokia.com> | 2010-09-15 16:43:49 +0200 |
commit | 5a1924f1a06e31105b5f7823cb6a5f5f20513f49 (patch) | |
tree | e0f968b41132cecd3fbe93c188097ae93c73a2c9 /src/shared/cplusplus | |
parent | 02966feab6b75a1f81f1923a49c8e0576ca85333 (diff) | |
download | qt-creator-5a1924f1a06e31105b5f7823cb6a5f5f20513f49.tar.gz |
C++: fixed invalid parsing of 'call()->call()'.
Diffstat (limited to 'src/shared/cplusplus')
-rw-r--r-- | src/shared/cplusplus/Parser.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/shared/cplusplus/Parser.cpp b/src/shared/cplusplus/Parser.cpp index 73cea0009b..eb1b7f7463 100644 --- a/src/shared/cplusplus/Parser.cpp +++ b/src/shared/cplusplus/Parser.cpp @@ -1392,8 +1392,21 @@ bool Parser::parseDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_specif // ### parse ref-qualifiers parseExceptionSpecification(ast->exception_specification); - if (_cxx0xEnabled && ! node->ptr_operator_list && LA() == T_ARROW) - parseTrailingReturnType(ast->trailing_return_type); + if (_cxx0xEnabled && ! node->ptr_operator_list && LA() == T_ARROW) { + // only allow if there is 1 type spec, which has to be 'auto' + bool hasAuto = false; + for (SpecifierListAST *iter = decl_specifier_list; !hasAuto && iter; iter = iter->next) { + SpecifierAST *spec = iter->value; + if (SimpleSpecifierAST *simpleSpec = spec->asSimpleSpecifier()) { + if (_translationUnit->tokenKind(simpleSpec->specifier_token) == T_AUTO) { + hasAuto = true; + } + } + } + + if (hasAuto) + parseTrailingReturnType(ast->trailing_return_type); + } *postfix_ptr = new (_pool) PostfixDeclaratorListAST(ast); postfix_ptr = &(*postfix_ptr)->next; |