Skip to content

Commit 322c4d6

Browse files
derekmaurocopybara-github
authored andcommitted
str_cat_test: Avoid using invalid enum values
Invalid enum values are undefined behavior. This change makes the enum backed by an integer for testing. Our UBSAN tests were missing `-fno-sanitize-recover`, which means UBSAN logs a warning, but the program continues, causing the test not to fail. `-fno-sanitize-recover` will be added once all errors are fixed. PiperOrigin-RevId: 733450563 Change-Id: I0644af2ecb9ca6def5fa0c9c948d76dda54af97f
1 parent 9fee338 commit 322c4d6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

absl/strings/str_cat_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ TEST(StrCat, Ints) {
7878
TEST(StrCat, Enums) {
7979
enum SmallNumbers { One = 1, Ten = 10 } e = Ten;
8080
EXPECT_EQ("10", absl::StrCat(e));
81-
EXPECT_EQ("-5", absl::StrCat(SmallNumbers(-5)));
81+
EXPECT_EQ("1", absl::StrCat(One));
8282

8383
enum class Option { Boxers = 1, Briefs = -1 };
8484

0 commit comments

Comments
 (0)