October 29 [Issue 24837] New: Can't version() or static if() to include keys in an enum | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24837 Issue ID: 24837 Summary: Can't version() or static if() to include keys in an enum Product: D Version: D2 Hardware: All URL: http://dlang.org/ OS: All Status: NEW Severity: normal Priority: P3 Component: dmd Assignee: nobody@puremagic.com Reporter: turkeyman@gmail.com I'm trying to update some of the WIN32 API bindings in druntime, but a lot of them have enums, where additional keys have been introduced in different API versions. The problem is, we can't have static if() or version() appear inside of lists. Basically, in order to create correct bindings, I want this to work: static if (NTDDI_VERSION >= NTDDI_LONGHORN) { enum FILE_INFO_BY_HANDLE_CLASS { FileBasicInfo, FileStandardInfo, FileNameInfo, FileRenameInfo, FileDispositionInfo, FileAllocationInfo, FileEndOfFileInfo, FileStreamInfo, FileCompressionInfo, FileAttributeTagInfo, FileIdBothDirectoryInfo, FileIdBothDirectoryRestartInfo, FileIoPriorityHintInfo, FileRemoteProtocolInfo, FileFullDirectoryInfo, FileFullDirectoryRestartInfo, static if (NTDDI_VERSION >= NTDDI_WIN8) { FileStorageInfo, FileAlignmentInfo, FileIdInfo, FileIdExtdDirectoryInfo, FileIdExtdDirectoryRestartInfo, } static if (NTDDI_VERSION >= NTDDI_WIN10_RS1) { FileDispositionInfoEx, FileRenameInfoEx, } static if (NTDDI_VERSION >= NTDDI_WIN10_19H1) { FileCaseSensitiveInfo, FileNormalizedNameInfo, } MaximumFileInfoByHandleClass } alias PFILE_INFO_BY_HANDLE_CLASS = FILE_INFO_BY_HANDLE_CLASS*; } -- |
Copyright © 1999-2021 by the D Language Foundation