www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13813] New: DMD accepts non-static assert statement at module

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 puremagic.com
          Reporter: briancschott 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.

--
Dec 03 2014