From 1980516eebc4940cebf394c9c086d4c9b4d53dc4 Mon Sep 17 00:00:00 2001 From: Patryk Stefanski Date: Mon, 19 May 2025 12:01:39 +0200 Subject: [PATCH] [BoundsSafety] Fix Sema/compound-literal-ended_by.c test After d58d5d6e9d6761f88344f439e7fdf63d41c8c384, we emit an error earlier for compound literals that occur outside the body of a function and are not constant expressions. rdar://151424542 --- .../Sema/compound-literal-ended_by.c | 5 ++--- clang/test/BoundsSafety/Sema/compound-literal-ended_by.c | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/clang/test/BoundsSafety-legacy-checks/Sema/compound-literal-ended_by.c b/clang/test/BoundsSafety-legacy-checks/Sema/compound-literal-ended_by.c index 7b246df07df3a..d654f6309a128 100644 --- a/clang/test/BoundsSafety-legacy-checks/Sema/compound-literal-ended_by.c +++ b/clang/test/BoundsSafety-legacy-checks/Sema/compound-literal-ended_by.c @@ -176,10 +176,9 @@ struct eb_with_other_data field_initializers_with_side_effects(struct eb_with_ot struct eb_with_other_data global_eb_with_other_data_side_effect_init = (struct eb_with_other_data) { - // FIXME: Location of first non-constant is wrong (rdar://81135826) - .start = 0x0, // both-error{{initializer element is not a compile-time constant}} + .start = 0x0, .end = 0x0, - .other = side_effect() + .other = side_effect() // both-error{{initializer element is not a compile-time constant}} }; struct eb_with_other_data side_effects_in_ptrs(struct eb_with_other_data* s) { diff --git a/clang/test/BoundsSafety/Sema/compound-literal-ended_by.c b/clang/test/BoundsSafety/Sema/compound-literal-ended_by.c index fdac7adb09cc0..67eba36c81376 100644 --- a/clang/test/BoundsSafety/Sema/compound-literal-ended_by.c +++ b/clang/test/BoundsSafety/Sema/compound-literal-ended_by.c @@ -172,10 +172,9 @@ struct eb_with_other_data field_initializers_with_side_effects(struct eb_with_ot struct eb_with_other_data global_eb_with_other_data_side_effect_init = (struct eb_with_other_data) { - // FIXME: Location of first non-constant is wrong (rdar://81135826) - .start = 0x0, // both-error{{initializer element is not a compile-time constant}} + .start = 0x0, .end = 0x0, - .other = side_effect() + .other = side_effect() // both-error{{initializer element is not a compile-time constant}} }; struct eb_with_other_data side_effects_in_ptrs(struct eb_with_other_data* s) {