Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
20545fd4
Commit
20545fd4
authored
Jun 19, 2009
by
Roberto Raggi
Browse files
Fixed more template-id vs expressions ambiguites.
parent
3545c822
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/shared/cplusplus/Parser.cpp
View file @
20545fd4
...
...
@@ -2927,7 +2927,8 @@ bool Parser::parseNameId(NameAST *&name)
TemplateIdAST
*
template_id
=
name
->
asTemplateId
();
if
(
LA
()
==
T_LPAREN
&&
template_id
)
{
if
(
TemplateArgumentListAST
*
template_arguments
=
template_id
->
template_arguments
)
{
if
(
!
template_arguments
->
next
&&
template_arguments
->
template_argument
&&
template_arguments
->
template_argument
->
asBinaryExpression
())
{
if
(
!
template_arguments
->
next
&&
template_arguments
->
template_argument
&&
template_arguments
->
template_argument
->
asBinaryExpression
())
{
unsigned
saved
=
cursor
();
ExpressionAST
*
expr
=
0
;
bool
blocked
=
blockErrors
(
true
);
...
...
@@ -2949,13 +2950,16 @@ bool Parser::parseNameId(NameAST *&name)
}
}
if
(
LA
()
==
T_IDENTIFIER
||
if
(
LA
()
==
T_COMMA
||
LA
()
==
T_SEMICOLON
||
LA
()
==
T_LBRACKET
||
LA
()
==
T_LPAREN
)
return
true
;
else
if
(
LA
()
==
T_IDENTIFIER
||
LA
()
==
T_STATIC_CAST
||
LA
()
==
T_DYNAMIC_CAST
||
LA
()
==
T_REINTERPRET_CAST
||
LA
()
==
T_CONST_CAST
||
tok
().
isLiteral
()
||
(
tok
().
isOperator
()
&&
LA
()
!=
T_LPAREN
&&
LA
()
!=
T_LBRACKET
)
)
tok
().
isOperator
())
{
rewind
(
start
);
return
parseName
(
name
,
false
);
...
...
tests/auto/cplusplus/ast/tst_ast.cpp
View file @
20545fd4
...
...
@@ -45,6 +45,7 @@ private slots:
void
new_expression_1
();
void
new_expression_2
();
void
condition_1
();
void
init_1
();
// statements
void
if_statement
();
...
...
@@ -157,6 +158,16 @@ void tst_AST::condition_1()
QVERIFY
(
ast
!=
0
);
}
void
tst_AST
::
init_1
()
{
QSharedPointer
<
TranslationUnit
>
unit
(
parseDeclaration
(
"
\n
"
"x y[] = { X<10>, y };"
));
AST
*
ast
=
unit
->
ast
();
QVERIFY
(
ast
!=
0
);
}
void
tst_AST
::
if_statement
()
{
QSharedPointer
<
TranslationUnit
>
unit
(
parseStatement
(
"if (a) b;"
));
...
...
tests/manual/cplusplus/main.cpp
View file @
20545fd4
...
...
@@ -552,10 +552,10 @@ int main(int argc, char *argv[])
TranslationUnitAST
*
ast
=
unit
.
ast
()
->
asTranslationUnit
();
Q_ASSERT
(
ast
!=
0
);
Scop
e
global
Scope
;
Namespac
e
*
global
Namespace
=
control
.
newNamespace
(
0
,
0
)
;
Semantic
sem
(
&
control
);
for
(
DeclarationListAST
*
decl
=
ast
->
declarations
;
decl
;
decl
=
decl
->
next
)
{
sem
.
check
(
decl
->
declaration
,
&
global
Scope
);
sem
.
check
(
decl
->
declaration
,
global
Namespace
->
members
()
);
}
// test the rewriter
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment