D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 23037 - importC: type with only type-qualifier doesn't work
Summary: importC: type with only type-qualifier doesn't work
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 minor
Assignee: No Owner
URL:
Keywords: ImportC, pull
Depends on:
Blocks:
 
Reported: 2022-04-19 13:19 UTC by duser
Modified: 2022-05-05 21:04 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description duser 2022-04-19 13:19:45 UTC
const a;                  // ignored, doesn't declare "a"
const b = 1;              // syntax error
int c = sizeof(const);    // segfault in src/dmd/expression.d:3397
int d = (const)0;         // segfault in src/dmd/mtype.d:2710
int *e = (const*)0;       // segfault in src/dmd/mtype.d:4050
enum E : const { ee=1, }; // assert in src/dmd/dsymbolsem.d:2164

depending on what C11 allows, these should be either rejected in the parser or made to default to "int" like in other compilers

the line numbers are at dmd commit 41ca11ebf3cc9086906958ea448b69bf37dc36a0
Comment 1 Walter Bright 2022-04-20 07:08:32 UTC
C11 6.7.2-4 says "At least one type specifier shall be given in the declaration specifiers in each declaration"

I'll go with that.
Comment 2 Dlang Bot 2022-04-21 08:00:48 UTC
@WalterBright created dlang/dmd pull request #14018 "fix Issue 23037 - importC: type with only type-qualifier doesn't work" fixing this issue:

- fix Issue 23037 - importC: type with only type-qualifier doesn't work

https://github.com/dlang/dmd/pull/14018
Comment 3 Dlang Bot 2022-04-28 05:52:33 UTC
dlang/dmd pull request #14018 "fix Issue 23037 - importC: type with only type-qualifier doesn't work" was merged into stable:

- c19fd72e3e592ed6a72fca46b487e3246820b042 by Walter Bright:
  fix Issue 23037 - importC: type with only type-qualifier doesn't work

https://github.com/dlang/dmd/pull/14018
Comment 4 Dlang Bot 2022-05-05 21:04:14 UTC
dlang/dmd pull request #14064 "merge stable" was merged into master:

- 313d28b3db7523e67880ae3baf8ef28ce9abe9bd by Walter Bright:
  fix Issue 23037 - importC: type with only type-qualifier doesn't work (#14018)

https://github.com/dlang/dmd/pull/14064