[llvm-bugs] [Bug 50005] New: fatal error: base class '...' has a flexible array member
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Apr 16 12:53:52 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=50005
Bug ID: 50005
Summary: fatal error: base class '...' has a flexible array
member
Product: clang
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: llvm at behdad.org
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
In HarfBuzz we extensively use the Struct Hack [0]. Up until now we've used
"array[1]" for that. This upsets ubsan [1]. So I'm looking to replace it with
flexible arrays on compilers that support it.
However, trying to do that I get the "base class '...' has a flexible array
member" error. The derived class only has one base class and no members. So I
like to ask that this special-case be allowed.
Test case, based on actual code:
```
struct UnsignedArray {
unsigned count;
int array[];
};
struct SortedUnsignedArray : UnsignedArray {
};
```
I've tested this with Apple clang 12.
[0] http://c-faq.com/struct/structhack.html
[1] https://github.com/harfbuzz/harfbuzz/issues/2953
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210416/fad23b6b/attachment.html>
More information about the llvm-bugs
mailing list