Skip to content

Commit 4bdd141

Browse files
Fix address-of overloaded member function std::allocator::allocate
1 parent 4fddc38 commit 4bdd141

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

cpp/misra/test/rules/RULE-21-6-2/DynamicMemoryManagedManually.expected

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -64,21 +64,21 @@
6464
| test.cpp:229:7:229:26 | operator delete[] | Taking the address of banned `operator delete[]`. |
6565
| test.cpp:233:7:233:24 | operator delete | Taking the address of banned `operator delete`. |
6666
| test.cpp:235:7:235:26 | operator delete[] | Taking the address of banned `operator delete[]`. |
67-
| test.cpp:243:13:243:41 | allocate | Taking the address of banned `std::allocator<C1>::allocate`. |
68-
| test.cpp:245:13:245:43 | deallocate | Taking the address of banned `std::allocator<C1>::deallocate`. |
69-
| test.cpp:251:7:251:23 | allocate | Taking the address of banned `std::allocator_traits<allocator<C1>>::allocate`. |
70-
| test.cpp:254:8:254:25 | deallocate | Taking the address of banned `std::allocator_traits<allocator<C1>>::deallocate`. |
71-
| test.cpp:258:13:258:48 | allocate | Taking the address of banned `std::pmr::memory_resource::allocate`. |
72-
| test.cpp:261:7:261:44 | deallocate | Taking the address of banned `std::pmr::memory_resource::deallocate`. |
73-
| test.cpp:265:13:266:19 | allocate | Taking the address of banned `std::pmr::polymorphic_allocator<C1>::allocate`. |
74-
| test.cpp:268:13:269:21 | deallocate | Taking the address of banned `std::pmr::polymorphic_allocator<C1>::deallocate`. |
75-
| test.cpp:273:13:274:24 | allocate | Taking the address of banned `std::pmr::memory_resource::allocate`. |
76-
| test.cpp:276:14:277:27 | deallocate | Taking the address of banned `std::pmr::memory_resource::deallocate`. |
77-
| test.cpp:281:14:282:25 | allocate | Taking the address of banned `std::pmr::memory_resource::allocate`. |
78-
| test.cpp:284:14:285:27 | deallocate | Taking the address of banned `std::pmr::memory_resource::deallocate`. |
79-
| test.cpp:289:14:290:25 | allocate | Taking the address of banned `std::pmr::memory_resource::allocate`. |
80-
| test.cpp:292:14:293:27 | deallocate | Taking the address of banned `std::pmr::memory_resource::deallocate`. |
81-
| test.cpp:299:7:299:28 | allocate | Taking the address of banned `std::scoped_allocator_adaptor<allocator<C1>>::allocate`. |
82-
| test.cpp:302:7:302:30 | deallocate | Taking the address of banned `std::scoped_allocator_adaptor<allocator<C1>>::deallocate`. |
83-
| test.cpp:309:13:309:41 | release | Taking the address of banned `std::unique_ptr<C1, default_delete<C1>>::release`. |
84-
| test.cpp:312:7:312:37 | release | Taking the address of banned `std::unique_ptr<C1[], default_delete<C1[]>>::release`. |
67+
| test.cpp:244:7:244:35 | allocate | Taking the address of banned `std::allocator<C1>::allocate`. |
68+
| test.cpp:246:13:246:43 | deallocate | Taking the address of banned `std::allocator<C1>::deallocate`. |
69+
| test.cpp:252:7:252:23 | allocate | Taking the address of banned `std::allocator_traits<allocator<C1>>::allocate`. |
70+
| test.cpp:255:8:255:25 | deallocate | Taking the address of banned `std::allocator_traits<allocator<C1>>::deallocate`. |
71+
| test.cpp:259:13:259:48 | allocate | Taking the address of banned `std::pmr::memory_resource::allocate`. |
72+
| test.cpp:262:7:262:44 | deallocate | Taking the address of banned `std::pmr::memory_resource::deallocate`. |
73+
| test.cpp:266:13:267:19 | allocate | Taking the address of banned `std::pmr::polymorphic_allocator<C1>::allocate`. |
74+
| test.cpp:269:13:270:21 | deallocate | Taking the address of banned `std::pmr::polymorphic_allocator<C1>::deallocate`. |
75+
| test.cpp:274:13:275:24 | allocate | Taking the address of banned `std::pmr::memory_resource::allocate`. |
76+
| test.cpp:277:14:278:27 | deallocate | Taking the address of banned `std::pmr::memory_resource::deallocate`. |
77+
| test.cpp:282:14:283:25 | allocate | Taking the address of banned `std::pmr::memory_resource::allocate`. |
78+
| test.cpp:285:14:286:27 | deallocate | Taking the address of banned `std::pmr::memory_resource::deallocate`. |
79+
| test.cpp:290:14:291:25 | allocate | Taking the address of banned `std::pmr::memory_resource::allocate`. |
80+
| test.cpp:293:14:294:27 | deallocate | Taking the address of banned `std::pmr::memory_resource::deallocate`. |
81+
| test.cpp:300:7:300:28 | allocate | Taking the address of banned `std::scoped_allocator_adaptor<allocator<C1>>::allocate`. |
82+
| test.cpp:303:7:303:30 | deallocate | Taking the address of banned `std::scoped_allocator_adaptor<allocator<C1>>::deallocate`. |
83+
| test.cpp:310:13:310:41 | release | Taking the address of banned `std::unique_ptr<C1, default_delete<C1>>::release`. |
84+
| test.cpp:313:7:313:37 | release | Taking the address of banned `std::unique_ptr<C1[], default_delete<C1[]>>::release`. |

cpp/misra/test/rules/RULE-21-6-2/test.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@ void take_address_of_operator_delete() {
240240

241241
void take_address_of_allocate_deallocate() {
242242
// std::allocator
243-
auto p1 = &std::allocator<C1>::allocate; // NON_COMPLIANT: address of
243+
C1 *(std::allocator<C1>::*p1)(std::size_t) =
244+
&std::allocator<C1>::allocate; // NON_COMPLIANT: address of
244245
// std::allocator::allocate
245246
auto p2 = &std::allocator<C1>::deallocate; // NON_COMPLIANT: address of
246247
// std::allocator::deallocate

0 commit comments

Comments
 (0)