[Issue 21811] New: Unable to use IfCondition as expression in while statement

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 8 21:20:48 UTC 2021


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

          Issue ID: 21811
           Summary: Unable to use IfCondition as expression in while
                    statement
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: mrjnewt at gmail.com

According to the language spec, a while loop takes an IfCondition as its
expression.  IfConditions allow introducing a variable and assigning it but
this does not actually parse in the context of a WhileStatement.  The
documentation for the WhileStatement explicitly mentions introducing a variable
with auto as subpoint #3.

WhileStatement: https://dlang.org/spec/statement.html#while-statement
IfCondition: https://dlang.org/spec/statement.html#IfCondition

Sample repro which fails to compile: https://run.dlang.io/is/VGwtDT

--


More information about the Digitalmars-d-bugs mailing list