Bug 19109 – [SPEC] handling of unknown pragmas inconsistent with spec

Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-07-22T17:10:07Z
Last change time
2023-12-31T22:35:09Z
Assigned to
Iain Buclaw
Creator
Iain Buclaw

Comments

Comment #0 by ibuclaw — 2018-07-22T17:10:07Z
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.
Comment #1 by b2.temp — 2023-12-16T15:11:29Z
Is that issue still valid after https://github.com/dlang/dmd/pull/15893/files ?
Comment #2 by ibuclaw — 2023-12-31T22:34:39Z
(In reply to Basile-z from comment #1) > Is that issue still valid after > https://github.com/dlang/dmd/pull/15893/files ? That didn't do anything to change the situation. Looks like the error message has now been gagged since https://github.com/dlang/dmd/pull/10443
Comment #3 by ibuclaw — 2023-12-31T22:35:09Z
*** This issue has been marked as a duplicate of issue 3004 ***