================
@@ -108,3 +108,8 @@ void test_f1() {
   int ir = (f1)(nullptr);
 }
 
+// __nullptr keyword in C
+void foo(void *);
+void bar() { foo(__nullptr); }
+static_assert(nullptr == __nullptr);
+static_assert(_Generic(typeof(__nullptr), nullptr_t: true, default: false));
----------------
AaronBallman wrote:

Given that this is intended to expose `nullptr` in language modes which don't 
have it, I think we may also want some test coverage for C17 along the lines of:
```
void foo(struct S *);
void bar() { foo(__nullptr); } // Test that it converts properly to an 
arbitrary pointer type without warning
_Static_assert(__nullptr == 0); // Test that its value matches that of NULL
_Static_assert(_Generic(__typeof(__nullptr), int : 0, void * : 0, default : 
1)); // Test that it's type is not the same as what NULL would generally have.
```

https://github.com/llvm/llvm-project/pull/123119
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to