www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10791] New: Strange asm behavior in if's

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10791

           Summary: Strange asm behavior in if's
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: temtaime gmail.com



if(1)
        asm {};
    else
        asm {};

Error: found 'else' instead of statement
Error: unrecognized declaration

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 11 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10791


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID



http://dlang.org/statement.html

Statement:
  NonEmptyStatement

NonEmptyStatement:
  NonEmptyStatementNoCaseNoDefault

NonEmptyStatementNoCaseNoDefault:
  AsmStatement

AsmStatement:
  asm { }
  asm { AsmInstructionList }

AsmStatement does not take semicolon at the end, then

if(1)
        asm {};
    else
        asm {};

is mostly same as:

if (1) { asm {} }
;
else { asm {} }
;

and the 'else' part is stray.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 13 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10791




Why asm statement doesn't follow common rules?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 13 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10791


Maxim Fomin <maxim maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxim maxim-fomin.ru



---

 Why asm statement doesn't follow common rules?
One reason is because although AsmStatement is formally a statement, it is actually close to a BlockStatement (AsmInstruction is close to regular statement) and BlockStatements don't have ";" after them (like aggregate type declarations and enum declarations). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 13 2013