Bug 16088 – Parse error for import expression in statement

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-05-28T18:47:35Z
Last change time
2018-06-14T13:58:17Z
Assigned to
No Owner
Creator
timon.gehr

Comments

Comment #0 by timon.gehr — 2016-05-28T18:47:35Z
DMD 2.071.0: The following code causes a parse error. void bar(string x){ } auto foo(){ import("a.d").bar; } This should parse.
Comment #1 by razvan.nitu1305 — 2018-06-13T10:03:32Z
Why should it parse? The grammar [1] shows that after the "import" keyword an identifier is expected not '('. Maybe close as invalid? [1] https://dlang.org/spec/grammar.html#ImportDeclaration
Comment #2 by timon.gehr — 2018-06-13T10:25:09Z
Comment #3 by razvan.nitu1305 — 2018-06-13T12:15:08Z
(In reply to timon.gehr from comment #2) > https://dlang.org/spec/grammar.html#ImportExpression You are are right. Thank you. PR: https://github.com/dlang/dmd/pull/8356
Comment #4 by github-bugzilla — 2018-06-14T13:58:16Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/6ebf865e893f310442b1d3cae9c764863a1d9246 Fix Issue 16088 - Parse error for import expression in statement https://github.com/dlang/dmd/commit/56a69ae463bec5e63ad7e5d7c2539b495e19c012 Merge pull request #8356 from RazvanN7/Issue_16051 Fix Issue 16088 - Parse error for import expression in statement