| 332 | |
| 333 | template <class T> |
| 334 | void PassByConstReference(const T& val) { |
| 335 | // In https://st.yandex-team.ru/IGNIETFERRO-294 was assumed that `const char[]` types are compile time strings |
| 336 | // and that CharTraits::Length may not be called for them. Unfortunately that is not true, `char[]` types |
| 337 | // are easily converted to `const char[]` if they are passed to a function accepting `const T&`. |
| 338 | UNIT_ASSERT(TStringBuf(val).size() == 5); |
| 339 | } |
| 340 | |
| 341 | Y_UNIT_TEST(TestPassingArraysByConstReference) { |
| 342 | char data[] = "Hello\0word"; |