| 91 | } |
| 92 | |
| 93 | void BadAlignmentTest() { |
| 94 | #if BUILDFLAG(IS_WIN) |
| 95 | // Suppress the assertion MessageBox() normally displayed by the CRT in debug |
| 96 | // mode. In release mode, _CrtSetReportMode() is #defined to ((int)0), so |
| 97 | // |previous| would appear unused, thus the [[maybe_unused]]. |
| 98 | [[maybe_unused]] int previous = |
| 99 | _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG); |
| 100 | #endif |
| 101 | |
| 102 | // Alignment constraints must be powers of 2. 7 is not valid. |
| 103 | AlignedVector<int, 7> bad_aligned_vector; |
| 104 | bad_aligned_vector.push_back(0); |
| 105 | |
| 106 | #if BUILDFLAG(IS_WIN) |
| 107 | _CrtSetReportMode(_CRT_ASSERT, previous); |
| 108 | #endif |
| 109 | } |
| 110 | |
| 111 | TEST(AlignedAllocatorDeathTest, BadAlignment) { |
| 112 | ASSERT_DEATH_CRASH(BadAlignmentTest(), ""); |