C++11: Fix and add test for simple decltype uses.

Change-Id: I7f843fa96e33671ecb135b9db6f68d9f2cbf2fac
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Christian Kamm
2012-09-19 14:27:05 +02:00
committed by hjk
parent c060d778bb
commit a81389356e
3 changed files with 12 additions and 1 deletions

View File

@@ -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;

View 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;

View File

@@ -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()