Thread overview
[Issue 5432] New: if/for/while inconsistency: while( auto a = ... ) does not compile
Jan 08, 2011
Éric Estièvenart
Aug 27, 2011
yebblies
[Issue 5432] Allow variable declaration inside while condition
Aug 27, 2011
yebblies
Aug 27, 2011
yebblies
January 08, 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@puremagic.com
        ReportedBy: eric.estievenart@free.fr


--- Comment #0 from Éric Estièvenart <eric.estievenart@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: -------
August 27, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5432


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com


--- Comment #1 from yebblies <yebblies@gmail.com> 2011-08-28 02:17:45 EST ---
*** Issue 6550 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 27, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5432


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies@gmail.com
          Component|websites                    |DMD
            Summary|if/for/while inconsistency: |Allow variable declaration
                   |while( auto a = ... ) does  |inside while condition
                   |not compile                 |
           Severity|normal                      |enhancement


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 27, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5432


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #2 from yebblies <yebblies@gmail.com> 2011-08-28 03:56:34 EST ---
https://github.com/D-Programming-Language/dmd/pull/342

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