[clang] 7054171 - Additional test coverage for WG14 N3037 (#202674)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 23 09:15:34 PDT 2026


Author: Aaron Ballman
Date: 2026-06-23T12:15:29-04:00
New Revision: 7054171f229e2a9d55ed742dcf89782727579926

URL: https://github.com/llvm/llvm-project/commit/7054171f229e2a9d55ed742dcf89782727579926
DIFF: https://github.com/llvm/llvm-project/commit/7054171f229e2a9d55ed742dcf89782727579926.diff

LOG: Additional test coverage for WG14 N3037 (#202674)

There was a request for additional test coverage in:
https://github.com/llvm/llvm-project/pull/201650#discussion_r3376475306

Added: 
    

Modified: 
    clang/test/C/C23/n3037.c

Removed: 
    


################################################################################
diff  --git a/clang/test/C/C23/n3037.c b/clang/test/C/C23/n3037.c
index 198f0487bead1..8dd46ef69b414 100644
--- a/clang/test/C/C23/n3037.c
+++ b/clang/test/C/C23/n3037.c
@@ -930,3 +930,21 @@ struct GH199417_2 {   // c17-note {{previous definition is here}}
 struct GH199417_2 {
   enum GH199417_E2 { eGH199417 } u; // c23-note {{field 'u' has type 'enum GH199417_E2' here}}
 };
+
+struct GH199417_3 {     // c17-note {{previous definition is here}}
+  struct GH199417_4 {   // c17-note {{previous definition is here}}
+    union { int i; } u; // c23-note-re {{field 'u' has type 'union (unnamed at {{.*}})' here}}
+  } a;                  // c23-note {{field 'a' has type 'struct GH199417_4' here}}
+};
+
+// c23-error at +2 {{type 'struct GH199417_3' has incompatible definitions}}
+// c17-error at +1 {{redefinition of 'GH199417_3'}}
+struct GH199417_3 {
+  // c23-error at +2 {{type 'struct GH199417_4' has incompatible definitions}}
+  // c17-error at +1 {{redefinition of 'GH199417_4'}}
+  struct GH199417_4 {
+    enum GH199417_E3 { eeGH199417 } u; // c23-note {{field 'u' has type 'enum GH199417_E3' here}}
+    // FIXME: the below diagnostic uses type 'int' because of error recovery,
+    // it would be better to print the original type.
+  } a;                                 // c23-note {{field 'a' has type 'int' here}}
+};


        


More information about the cfe-commits mailing list