[Issue 18199] Error with lambda in struct initializer

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 10 10:51:39 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18199

--- Comment #10 from github-bugzilla at puremagic.com ---
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/019f0016cf7a6e11584fe0188f9e692215cce212
fix Issue 18199 - Error with lambda in struct initializer

Allow struct initializers to include all function literal forms.

Previously, a function literal containing semicolon or return tokens
would cause the containing struct initializer to be incorrectly
treated as a parameterless funtion literal (i.e. {statements...}).

The issue is resolved by only aborting the struct initializer
lookahead when statement tokens appear at the top curly bracket scope.

A bug in the converse case, where a function literal containing no
semicolon or return tokens would be incorrectly parsed as a struct
initializer, is also addressed.

Also, document another ambiguous case in function literal vs.
struct initializer, as well as explain why these are resolved as
struct initializer.

https://github.com/dlang/dmd/commit/1edd074334f9f65d75d318df347f377d69eb002e
Merge pull request #8051 from belm0/fix-18199

fix Issue 18199 - Error with lambda in struct initializer
merged-on-behalf-of: Mike Franklin <JinShil at users.noreply.github.com>

--


More information about the Digitalmars-d-bugs mailing list