Bug 1355 – Can't declare struct with align attribute in a statement body.
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2007-07-20T15:38:22Z
Last change time
2019-06-02T06:20:53Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
Aziz Köksal
Comments
Comment #0 by aziz.koeksal — 2007-07-20T15:38:22Z
void foo()
{
align (1) struct bar { int a; }
}
Comment #1 by manuelk89 — 2010-03-08T09:33:11Z
I ran into this bug on LDC too (don't have dmd at hand), see this closed bug: http://www.dsource.org/projects/ldc/ticket/399 .
It turns out that it's probably a parse error (which implies that it's most likely not implemented in the back end too). Christian Kamm could also reproduce this on dmd. I don't know which version he used though, probably one of the newer 1.05x releases.
As a workaround you can of course declare the struct on module level.
Comment #2 by pro.mathias.lang — 2019-06-02T06:20:53Z