[clang] [clang] Fix a crash issue that caused by handling of fields with initializers in nested anonymous unions (PR #113049)
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 25 00:52:52 PST 2024
================
@@ -115,3 +115,14 @@ namespace nested_union {
// of Test3, or we should exclude f(Test3) as a candidate.
static_assert(f({1}) == 2, ""); // expected-error {{call to 'f' is ambiguous}}
}
+
+// Fix crash issue https://github.com/llvm/llvm-project/issues/112560.
+// Make sure clang compiles the following code without crashing:
+namespace GH112560 {
+union U {
+ int f = ; // expected-error {{expected expression}}
----------------
hokein wrote:
Can you add an ast-dump testcase in `ast-dump-recovery.cpp` as well?
https://github.com/llvm/llvm-project/pull/113049
More information about the cfe-commits
mailing list