Bug 13813 – DMD accepts non-static assert statement at module scope

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-12-03T22:37:00Z
Last change time
2014-12-03T22:41:51Z
Keywords
accepts-invalid, spec
Assigned to
nobody
Creator
briancschott
Blocks
10233

Comments

Comment #0 by briancschott — 2014-12-03T22:37:59Z
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.
Comment #1 by briancschott — 2014-12-03T22:41:51Z
Disregard this. I was confused by the indentation level.