[Issue 19109] New: [SPEC] pragma implementation inconsistent with spec
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jul 22 17:10:07 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=19109
Issue ID: 19109
Summary: [SPEC] pragma implementation inconsistent with spec
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: ibuclaw at gdcproject.org
According to https://dlang.org/spec/pragma.html
```
Pragmas can appear as either declarations, Pragma DeclarationBlock, or as
statements, PragmaStatement.
---
1. pragma(ident);
2. pragma(ident) declaration_or_statement;
3. pragma(ident):
declaration;
declaration;
4. pragma(ident)
{
declaration_or_statement;
declaration_or_statement;
}
---
```
And yet item [2] doesn't seem to be the case, e.g:
```
pragma(msg, "test") // Error: missing a terminating ';'
void testA() { }
pragma(mangle, "test") // But this is OK
void testB() { }
pragma(custom_pragma) // Error: missing a terminating ';'
void testC() { }
```
The third example above is of main concern regarding the discrepancy. In the
first example, an error would be expected as that particular pragma is only
allowed as a statement by definition.
--
More information about the Digitalmars-d-bugs
mailing list