Commit 4e7bf7a7 authored by Milian Wolff's avatar Milian Wolff
Browse files

support arbitrary order of type-specifier and storage-class-specifier

TODO: we really need to adhere to the spec better by adding a
      parserDeclSpecifier which should solve this problem and others

BUG: 253827
parent b637ec56
......@@ -3478,6 +3478,8 @@ bool Parser::parseLabeledStatement(StatementAST *&node)
return false;
}
///TODO: decl-specifier-seq is currently not used at all,
/// can lead to problems for certain orders of specifiers
bool Parser::parseBlockDeclaration(DeclarationAST *&node)
{
switch(session->token_stream->lookAhead())
......@@ -3518,6 +3520,9 @@ bool Parser::parseBlockDeclaration(DeclarationAST *&node)
return false;
}
if (!storageSpec) // see also https://bugs.kde.org/show_bug.cgi?id=253827
parseStorageClassSpecifier(storageSpec);
parseCvQualify(cv);
spec->cv = cv;
......
......@@ -811,6 +811,15 @@ void TestParser::testTypeID()
QVERIFY(control.problems().isEmpty());
}
void TestParser::testRegister()
{
// see also: http://bugsfiles.kde.org/attachment.cgi?id=61647
QString code = "void foo() { register int i; int register j; }\n";
TranslationUnitAST* ast = parse(code.toLocal8Bit());
dumper.dump(ast, lastSession->token_stream);
QVERIFY(control.problems().isEmpty());
}
TranslationUnitAST* TestParser::parse(const QByteArray& unit)
{
control = Control(); // Clear the problems
......
......@@ -81,6 +81,8 @@ private slots:
void testTypeID_data();
void testTypeID();
void testRegister();
//BEGIN C++2011 support
void testRangeBasedFor();
void testRValueReference();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment