[Bug 151] New: Pragma without ';' results in undefined symbols
Stewart Gordon
smjg_1998 at yahoo.com
Tue May 30 06:36:19 PDT 2006
Chris Miller wrote:
> On Wed, 24 May 2006 12:31:15 -0400, Thomas Kuehne
> <thomas-dloop at kuehne.cn> wrote:
>
>> While
>> "pragma(lib, "ws2_32.lib") class Blah{}" [A]
>> is clearly illegal,
>> "pragma(lib, "ws2_32.lib") class Blah{};" [B]
>> is legal but buggy.
>>
>> http://www.dstress.com/d/pragma.html :
>>> pragma(ident) declaration; // influence one declaration
>
> Doesn't seem right, notice:
>
> pragma(ident) // influence block of declarations
> { declaration;
> declaration;
> }
Yes, that bit of the spec is rather loose. It seems it was intended to
illustrate, rather than to specify, with the semicolons there merely to
make them look like those declarations that happen to end with one.
> doesn't have ";" after the block. Anyway, the way you say wouldn't be
> consistent with other things, like "extern(C) void foo() {}" doesn't
> need ";" after. Plus, would that extra ";" have any significance?
<snip>
The syntax for pragmas is incomplete in the spec. But the trailing ";"
in Thomas's snippet is separate from both the class definition and the
pragma. It's a null DeclDef, allowed by the spec only at module level.
It appears that the point is to lighten the load for people coming
from C(++), where a semicolon is required after a struct, union, class
or enum definition.
Stewart.
More information about the Digitalmars-d-bugs
mailing list