[clang] fb9deab - Add additional test coverage for WG14 N3042

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 4 06:28:17 PDT 2025


Author: Aaron Ballman
Date: 2025-04-04T09:28:07-04:00
New Revision: fb9deab74e5dc9a9227732fcd95c1aadacf86d44

URL: https://github.com/llvm/llvm-project/commit/fb9deab74e5dc9a9227732fcd95c1aadacf86d44
DIFF: https://github.com/llvm/llvm-project/commit/fb9deab74e5dc9a9227732fcd95c1aadacf86d44.diff

LOG: Add additional test coverage for WG14 N3042

This addresses a post-commit request for some additional tests

Added: 
    

Modified: 
    clang/test/C/C23/n3042.c

Removed: 
    


################################################################################
diff  --git a/clang/test/C/C23/n3042.c b/clang/test/C/C23/n3042.c
index fdcb48eb1322a..56208419fb6d3 100644
--- a/clang/test/C/C23/n3042.c
+++ b/clang/test/C/C23/n3042.c
@@ -83,6 +83,9 @@ void test() {
   (float)null_val;      // expected-error {{cannot cast an object of type 'nullptr_t' to 'float'}}
   (float)nullptr;       // expected-error {{cannot cast an object of type 'nullptr_t' to 'float'}}
   (nullptr_t)(int *)12; // expected-error {{cannot cast an object of type 'int *' to 'nullptr_t'}}
+  (nullptr_t)"testing"; // expected-error {{cannot cast an object of type 'char *' to 'nullptr_t'}}
+  (nullptr_t)1.0f;      // expected-error {{cannot cast an object of type 'float' to 'nullptr_t'}}
+  (nullptr_t)'a';       // expected-error {{cannot cast an object of type 'int' to 'nullptr_t'}}
 
   (void)null_val;     // ok
   (void)nullptr;      // ok


        


More information about the cfe-commits mailing list