Skip to content

Commit

Permalink
Merge pull request #1422 from 9rnsr/fix9232
Browse files Browse the repository at this point in the history
Issue 9232 - Parsing error on some templated methods calls
  • Loading branch information
WalterBright committed Mar 4, 2013
2 parents e2df8c5 + d9a04e7 commit 2d452f1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/parse.c
Expand Up @@ -6277,15 +6277,14 @@ Expression *Parser::parseUnaryExp()
check(TOKrparen);

// if .identifier
// or .identifier!( ... )
if (token.value == TOKdot)
{
nextToken();
if (token.value != TOKidentifier)
if (peekNext() != TOKidentifier)
{ error("Identifier expected following (type).");
return NULL;
}
e = typeDotIdExp(loc, t, token.ident);
nextToken();
e = new TypeExp(loc, t);
e = parsePostExp(e);
}
else
Expand Down
17 changes: 17 additions & 0 deletions test/compilable/parse9232.d
@@ -0,0 +1,17 @@
// REQUIRED_ARGS: -o-
// PERMUTE_ARGS:

struct Foo
{
void bar(T)() {}
void baz() {}
}

void main()
{
Foo foo;
(foo).bar!int(); // Error: found '!' when expecting ';' following statement
((foo)).bar!int(); // OK
foo.bar!int(); // OK
(foo).baz(); // OK
}

0 comments on commit 2d452f1

Please sign in to comment.