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: unassignedclangb...@nondot.org
          Reporter: l...@behdad.org
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to