[clang] [clang] Fix a crash issue that caused by handling of fields with initializers in nested anonymous unions (PR #113049)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 21 08:27:30 PDT 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}}
----------------
yronglin wrote:
Thanks for the review! Make sense, there should have a RecoveryExpr as the initializer. I'd like to give a try.
https://github.com/llvm/llvm-project/pull/113049
More information about the cfe-commits
mailing list