[Issue 5432] New: if/for/while inconsistency: while( auto a = ... ) does not compile

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jan 8 06:32:45 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5432

           Summary: if/for/while inconsistency: while( auto a = ... ) does
                    not compile
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: websites
        AssignedTo: nobody at puremagic.com
        ReportedBy: eric.estievenart at free.fr


--- Comment #0 from Éric Estièvenart <eric.estievenart at free.fr> 2011-01-08 06:31:02 PST ---
void f()
{
  Object get() { return null; }
  if( auto a = get() )                {} // OK
  for( auto a = get(); a; a = get() ) {} // OK
  while( auto a = get() )             {} // Does not compile
}

autowhile.d(7): expression expected, not 'auto'
autowhile.d(7): found 'a' when expecting ')'
autowhile.d(7): found '=' instead of statement
autowhile.d(8): unrecognized declaration

This is clearly inconsistent, so logged as a bug and not an enhancement.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list