================
@@ -13,3 +14,37 @@ int *p2 = (int[]){
 int *p3 = (int[30]){
 #embed __FILE__ limit(30)
 };
+
+
+#ifdef NEGATIVE
+
+// Pointer element type
+char *bad_ptr = (int (*[5]) 0){ // expected-error {{expected ')'}}
+                                  // expected-note@-1 {{to match this '('}}
+// expected-error@-2 {{incompatible pointer types initializing}}
+// expected-error@-3 {{initializer element is not a compile-time constant}}
+#embed __FILE__
+// expected-error@-1 {{incompatible integer to pointer conversion}}
+// expected-warning@-2 {{excess elements in array initializer}}
+};
----------------
efriedma-quic wrote:

```suggestion
void *bad_ptr = (int*[]){
#embed __FILE__ // expected-error {{incompatible integer to pointer conversion}}
};
```

https://github.com/llvm/llvm-project/pull/182257
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to