[PATCH] D147626: [clang] Reject flexible array member in a union in C++

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 3 10:27:44 PDT 2023


aaron.ballman added a comment.

In D147626#4315283 <https://reviews.llvm.org/D147626#4315283>, @Fznamznon wrote:

> I've got an error from buildbot on Windows:
>
>   C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\winioctl.h:13404:51: error: flexible array member 'Lev1Depends' in a union is not allowed
>   
>           STORAGE_QUERY_DEPENDENT_VOLUME_LEV1_ENTRY Lev1Depends[];
>
> It feels like Windows headers contain flexible array members in unions. We probably can't just always reject them on Windows.

Thank you for the quick revert -- yeah, this means we have to make this work for MSVC compatibility, unfortunately. Any indication we're going to hit something similar with GCC compatibility in a glibc (or other system) header?

I think we'll have to back off the hard stance of always rejecting this because I think we'll need this to work in `-fms-compatibility` mode. If there's not indications of this being disruptive on non-MSVC-compatible targets, then we may still be able to get away with rejecting the extension there.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147626/new/

https://reviews.llvm.org/D147626



More information about the cfe-commits mailing list