Skip to content

Commit e9fc782

Browse files
author
Aidan
committed
added c17 tests
1 parent 514d5d6 commit e9fc782

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

clang/test/Sema/nullptr-prec2x.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@ int nullptr; // expected-warning {{'nullptr' is a keyword in C23}}
66

77
nullptr_t val; // expected-error {{unknown type name 'nullptr_t'}}
88

9+
void foo(void *);
10+
void bar() { foo(__nullptr); } // Test that it converts properly to an arbitrary pointer type without warning
11+
_Static_assert(__nullptr == 0, "value of __nullptr"); // Test that its value matches that of NULL
12+
_Static_assert(_Generic(__typeof(__nullptr), int : 0, void * : 0, default : 1), "type of __nullptr"); // Test that it's type is not the same as what NULL would generally have.

clang/test/Sema/nullptr.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,3 @@ void foo(void *);
113113
void bar() { foo(__nullptr); }
114114
static_assert(nullptr == __nullptr);
115115
static_assert(_Generic(typeof(__nullptr), nullptr_t: true, default: false));
116-
_Static_assert(__nullptr == 0); // Test that its value matches that of NULL
117-
_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.

0 commit comments

Comments
 (0)