forked from qt-creator/qt-creator
C++11: Fix and add test for simple decltype uses.
Change-Id: I7f843fa96e33671ecb135b9db6f68d9f2cbf2fac Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
1
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
1
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
@@ -3865,7 +3865,6 @@ bool Parser::parseBuiltinTypeSpecifier(SpecifierListAST *&node)
|
|||||||
if (parseExpression(ast->expression))
|
if (parseExpression(ast->expression))
|
||||||
match(T_RPAREN, &ast->rparen_token);
|
match(T_RPAREN, &ast->rparen_token);
|
||||||
node = new (_pool) SpecifierListAST(ast);
|
node = new (_pool) SpecifierListAST(ast);
|
||||||
skipUntilDeclaration();
|
|
||||||
return true;
|
return true;
|
||||||
} else if (lookAtBuiltinTypeSpecifier()) {
|
} else if (lookAtBuiltinTypeSpecifier()) {
|
||||||
SimpleSpecifierAST *ast = new (_pool) SimpleSpecifierAST;
|
SimpleSpecifierAST *ast = new (_pool) SimpleSpecifierAST;
|
||||||
|
|||||||
11
tests/auto/cplusplus/cxx11/data/declType.1.cpp
Normal file
11
tests/auto/cplusplus/cxx11/data/declType.1.cpp
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
template <class T, class R>
|
||||||
|
auto foo(T t, R r) -> decltype(t + r)
|
||||||
|
{}
|
||||||
|
|
||||||
|
int x;
|
||||||
|
decltype(x) foo;
|
||||||
|
decltype(x) foo();
|
||||||
|
|
||||||
|
// this does not work yet, as decltype is only parsed as a simple-specifier
|
||||||
|
// and not also as a nested-name-specifier
|
||||||
|
//decltype(vec)::value_type a;
|
||||||
@@ -147,6 +147,7 @@ void tst_cxx11::parse_data()
|
|||||||
QTest::newRow("enums.1") << "enums.1.cpp" << "";
|
QTest::newRow("enums.1") << "enums.1.cpp" << "";
|
||||||
QTest::newRow("templateGreaterGreater.1") << "templateGreaterGreater.1.cpp" << "";
|
QTest::newRow("templateGreaterGreater.1") << "templateGreaterGreater.1.cpp" << "";
|
||||||
QTest::newRow("packExpansion.1") << "packExpansion.1.cpp" << "";
|
QTest::newRow("packExpansion.1") << "packExpansion.1.cpp" << "";
|
||||||
|
QTest::newRow("declType.1") << "declType.1.cpp" << "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_cxx11::parse()
|
void tst_cxx11::parse()
|
||||||
|
|||||||
Reference in New Issue
Block a user