serge-sans-paille added inline comments.

================
Comment at: clang/test/Sema/array-parameter.c:2
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -Warray-parameter 
-verify %s
+
+void f0(int a[]);
----------------
aaron.ballman wrote:
> aaron.ballman wrote:
> > I'd like to see some additional test cases:
> > ```
> > void func(int *p);
> > void func(int a[2]); // Diagnose this one, I presume?
> > void func(int a[]); // But also diagnose this one as well, yes?
> > void func(int a[2]) {} // Do we then diagnose this as well, or is this 
> > matching a previous declaration and thus fine?
> > 
> > void other(int n, int m, int a[n]);
> > void other(int n, int m, int a[m]); // Hopefully we diagnose this set!
> > 
> > void another(int n, int array[n]);
> > void another(int n, int array[*]); // I *think* this should be warned, but 
> > I'm still a bit on the fence about it
> > ```
> > 
> > Also, if this is expected to work in C++ as well, we should probably have 
> > cases like:
> > ```
> > template <int N>
> > void func(int i[10]);
> > 
> > template <int N>
> > void func(int i[N]); // Should we diagnose this before instantiation or 
> > wait until we see the instantiation and only diagnose if differs?
> > 
> > static constexpr int Extent = 10;
> > void other(int i[10]);
> > void other(int i[Extent]); // Should not be diagnosed
> > ```
> Do you plan to add the C++ tests?
> template <int N>
> void func(int i[N]); // Should we diagnose this before instantiation or wait 
> until we see the instantiation and only diagnose if differs?


GCC never warns about this. Current patch always warn and this looks fine to me.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128449/new/

https://reviews.llvm.org/D128449

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to