Bug 22246 – importC: C11 does not allow _Alignof (expression)

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-08-27T10:52:32Z
Last change time
2021-09-30T01:46:00Z
Keywords
ImportC, pull
Assigned to
No Owner
Creator
Iain Buclaw

Comments

Comment #0 by ibuclaw — 2021-08-27T10:52:32Z
And yet we silently accept it. struct A { int a; }; int test() { struct A a; return _Alignof(a); }
Comment #1 by bugzilla — 2021-09-06T01:41:06Z
C11 6.5.3 says: _Alignof ( type-name ) so, you're right. It also works in that 4 is returned. But correctly fails with: return _Alignof(1); This means the C parser is working correctly. The problem happens because the translation creates a DotIdExp, which (with D) allows both a type and an expression. The trouble is in the semantic routine.
Comment #2 by dlang-bot — 2021-09-06T08:43:47Z
@WalterBright created dlang/dmd pull request #13051 "fix Issue 22246 - ImportC: C11 does not allow _Alignof (expression)" fixing this issue: - fix Issue 22246 - ImportC: C11 does not allow _Alignof (expression) https://github.com/dlang/dmd/pull/13051
Comment #3 by dlang-bot — 2021-09-08T11:45:08Z
dlang/dmd pull request #13051 "fix Issue 22246 - ImportC: C11 does not allow _Alignof (expression)" was merged into stable: - e13faae9efb066a4dcffcb7026dbeee99bbae7c3 by Walter Bright: fix Issue 22246 - ImportC: C11 does not allow _Alignof (expression) https://github.com/dlang/dmd/pull/13051
Comment #4 by dlang-bot — 2021-09-30T01:46:00Z
dlang/dmd pull request #13108 "merge stable" was merged into master: - 882257997f06dc956c3fb26996af3dd5a35eed77 by Walter Bright: fix Issue 22246 - ImportC: C11 does not allow _Alignof (expression) https://github.com/dlang/dmd/pull/13108