[Issue 13813] New: DMD accepts non-static assert statement at module scope

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Dec 3 14:37:59 PST 2014


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

          Issue ID: 13813
           Summary: DMD accepts non-static assert statement at module
                    scope
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: accepts-invalid, spec
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: briancschott at gmail.com
            Blocks: 10233

The following code is present in DMD's regression test suite
(test/runnable/cabi1.d):

version (Win64)
{
}
else
{
    Foo5 f5 = ctest5();
    assert(f5.i == 0x12345678);
    assert(f5.j == 0x21436587);
}

The parse tree, according to the specification should look something like this

Module:
  DeclDef:
    ConditionalDeclaration:
      DeclarationBlock:
        ?

The problem is that DeclarationBlock does not allow the assert statements, as
these asserts are not DeclDefs. If this is supposed to be allowed, I would like
to know why.

--


More information about the Digitalmars-d-bugs mailing list