Skip to content

Commit d96b670

Browse files
committed
test Clang-Tidy
1 parent 7f4c744 commit d96b670

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/unit/zero_cost_square.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,16 @@ auto square_scaled_integer(float input)
5454
auto square_elastic(float input)
5555
{
5656
// alias to scaled_integer<elastic_integer<31, int>, -16>
57-
auto fixed = elastic_scaled_integer<15, power<-16>>{input};
57+
// NOLINTNEXTLINE(cppcoreguidelines-owning-memory)
58+
auto fixed = new elastic_scaled_integer<15, power<-16>>{input};
5859

5960
// concise, safe and zero-cost!
60-
auto prod = fixed * fixed;
61+
auto prod = *fixed * *fixed;
62+
63+
if (input > 42) {
64+
// NOLINTNEXTLINE(cppcoreguidelines-owning-memory)
65+
delete fixed;
66+
}
6167

6268
return static_cast<float>(prod);
6369
}

0 commit comments

Comments
 (0)