@@ -11,31 +11,34 @@ class C1 {
1111public:
1212 C1 () {}
1313
14- // Class-specific operator declarations - NON_COMPLIANT (any signature)
15- void *
16- operator new (std::size_t size); // NON_COMPLIANT: class-specific declaration
17- void *
18- operator new [](std::size_t size); // NON_COMPLIANT: class-specific declaration
19- void operator delete (
20- void *ptr) noexcept ; // NON_COMPLIANT: class-specific declaration
21- void operator delete[] (
22- void *ptr) noexcept ; // NON_COMPLIANT: class-specific declaration
14+ // Class-specific operator declarations - NON_COMPLIANT[FALSE_NEGATIVE] (any
15+ // signature)
16+ void *operator new (std::size_t size); // NON_COMPLIANT[FALSE_NEGATIVE]:
17+ // class-specific declaration
18+ void *operator new [](std::size_t size); // NON_COMPLIANT[FALSE_NEGATIVE]:
19+ // class-specific declaration
20+ void operator delete (void *ptr) noexcept ; // NON_COMPLIANT[FALSE_NEGATIVE]:
21+ // class-specific declaration
22+ void operator delete[] (void *ptr) noexcept ; // NON_COMPLIANT[FALSE_NEGATIVE]:
23+ // class-specific declaration
2324 void *operator new (
2425 std::size_t size,
25- const std::nothrow_t
26- &) noexcept ; // NON_COMPLIANT: class-specific nothrow declaration
27- void *operator new (std::size_t size,
28- void *ptr) noexcept ; // NON_COMPLIANT: class-specific
29- // placement declaration
30- void *operator new [](std::size_t size,
31- void *ptr) noexcept ; // NON_COMPLIANT: class-specific
32- // placement declaration
26+ const std::nothrow_t &) noexcept ; // NON_COMPLIANT[FALSE_NEGATIVE]:
27+ // class-specific nothrow declaration
3328 void *
3429 operator new (std::size_t size,
35- int hint); // NON_COMPLIANT: class-specific custom declaration
30+ void *ptr) noexcept ; // NON_COMPLIANT[FALSE_NEGATIVE]:
31+ // class-specific placement declaration
3632 void *
37- operator new (std::size_t size, double alignment,
38- int pool); // NON_COMPLIANT: class-specific custom declaration
33+ operator new [](std::size_t size,
34+ void *ptr) noexcept ; // NON_COMPLIANT[FALSE_NEGATIVE]:
35+ // class-specific placement declaration
36+ void *operator new (std::size_t size,
37+ int hint); // NON_COMPLIANT[FALSE_NEGATIVE]: class-specific
38+ // custom declaration
39+ void *operator new (std::size_t size, double alignment,
40+ int pool); // NON_COMPLIANT[FALSE_NEGATIVE]: class-specific
41+ // custom declaration
3942};
4043
4144/* *
@@ -69,6 +72,43 @@ void *C1::operator new(std::size_t size, double alignment, int pool) {
6972 return std::malloc (size);
7073} // NON_COMPLIANT: class-specific custom
7174
75+ /* *
76+ * Fixture class with class-specific operator new/delete inline definitions.
77+ */
78+ class C2 {
79+ public:
80+ C2 () {}
81+
82+ // Class-specific operator inline definitions - NON_COMPLIANT (any signature)
83+ void *operator new (std::size_t size) {
84+ return std::malloc (size);
85+ } // NON_COMPLIANT: class-specific inline
86+ void *operator new [](std::size_t size) {
87+ return std::malloc (size);
88+ } // NON_COMPLIANT: class-specific inline
89+ void operator delete (void *ptr) noexcept {
90+ std::free (ptr);
91+ } // NON_COMPLIANT: class-specific inline
92+ void operator delete[] (void *ptr) noexcept {
93+ std::free (ptr);
94+ } // NON_COMPLIANT: class-specific inline
95+ void *operator new (std::size_t size, const std::nothrow_t &) noexcept {
96+ return std::malloc (size);
97+ } // NON_COMPLIANT: class-specific nothrow inline
98+ void *operator new (std::size_t size, void *ptr) noexcept {
99+ return ptr;
100+ } // NON_COMPLIANT: class-specific placement inline
101+ void *operator new [](std::size_t size, void *ptr) noexcept {
102+ return ptr;
103+ } // NON_COMPLIANT: class-specific placement inline
104+ void *operator new (std::size_t size, int hint) {
105+ return std::malloc (size);
106+ } // NON_COMPLIANT: class-specific custom inline
107+ void *operator new (std::size_t size, double alignment, int pool) {
108+ return std::malloc (size);
109+ } // NON_COMPLIANT: class-specific custom inline
110+ };
111+
72112/* *
73113 * Global replaceable forms - COMPLIANT
74114 * These are the "blessed" signatures that can be replaced globally.
0 commit comments