File tree 1 file changed +22
-0
lines changed
libc/test/src/__support/CPP
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -253,6 +253,28 @@ TEST(LlvmLibcTypeTraitsTest, is_enum_enum) {
253
253
254
254
// TODO is_null_pointer
255
255
256
+ TEST (LlvmLibcTypeTraitsTest, is_object) {
257
+ EXPECT_TRUE ((is_object_v<int >)); // scalar
258
+ EXPECT_TRUE ((is_object_v<Struct[]>)); // array
259
+ EXPECT_TRUE ((is_object_v<Union>)); // union
260
+ EXPECT_TRUE ((is_object_v<Class>)); // class
261
+
262
+ // pointers are still objects
263
+ EXPECT_TRUE ((is_object_v<int *>)); // scalar
264
+ EXPECT_TRUE ((is_object_v<Struct (*)[]>)); // array
265
+ EXPECT_TRUE ((is_object_v<Union *>)); // union
266
+ EXPECT_TRUE ((is_object_v<Class *>)); // class
267
+
268
+ // reference are not objects
269
+ EXPECT_FALSE ((is_object_v<int &>)); // scalar
270
+ EXPECT_FALSE ((is_object_v<Struct (&)[]>)); // array
271
+ EXPECT_FALSE ((is_object_v<Union &>)); // union
272
+ EXPECT_FALSE ((is_object_v<Class &>)); // class
273
+
274
+ // not an object
275
+ EXPECT_FALSE ((is_object_v<void >));
276
+ }
277
+
256
278
// TODO is_pointer
257
279
258
280
// TODO is_reference
You can’t perform that action at this time.
0 commit comments