================
@@ -246,6 +246,26 @@ void PTMFTester::convert() [[clang::nonblocking]]
        (this->*mConvertFunc)();
 }
 
+// Allow implicit conversion from array to pointer.
+void nb14(unsigned idx) [[clang::nonblocking]]
+{
+       using FP = void (*)() [[clang::nonblocking]];
+       using FPArray = FP[2];
+       auto nb = +[]() [[clang::nonblocking]] {};
+
+       FPArray src{ nb, nullptr };
+       FP f = src[idx]; // This should not generate a warning.
+
+       FP twoDim[2][2] = {};
+       FP g = twoDim[1][1];
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wvla-extension"
+       FP vla[idx];
+#pragma clang diagnostic pop
----------------
Sirraide wrote:

I think it’s fine to either just throw `-Wno-vla-extension` into the `RUN` line 
or to add `expected-` directives for this and the notes it produces. We 
generally try to avoid disabling and then reenabling warnings with `#pragma`s 
in tests because that just ends up being a bit hard to follow...

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

Reply via email to