www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19109] New: [SPEC] pragma implementation inconsistent with spec


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

4. pragma(ident)

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.

Jul 22 2018