Issue 240145
Summary [clang][Sema] Anonymous struct/union member that redeclares a class member, next to a flexible array member, plus a mem-initializer asserts `ClassDecl->hasFlexibleArrayMember() && "Incomplete array type is not valid"`
Labels clang:frontend, crash, generated by fuzzer
Assignees
Reporter YuanchengJiang
    The following code:
```cpp
struct S {
 int a;
  S() : a(0) {}
  struct { int a; int b[]; };
};
```

Resulted in this output:
```
<source>:4:16: error: member of anonymous struct redeclares 'a'
clang++: /root/llvm-project/llvm/tools/clang/lib/Sema/SemaDeclCXX.cpp:5655: bool clang::Sema::SetCtorInitializers(clang::CXXConstructorDecl*, bool, llvm::ArrayRef<clang::CXXCtorInitializer*>): Assertion `ClassDecl->hasFlexibleArrayMember() && "Incomplete array type is not valid"' failed.
```

Trunk reproducer (`-fsyntax-only`): https://godbolt.org/z/1oPYKsW4T
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to