mgehre marked an inline comment as done.

================
Comment at: 
test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp:13
@@ +12,3 @@
+
+void pointerfun(int* p);
+void arrayfun(int p[]);
----------------
aaron.ballman wrote:
> > Currently, the diag is
> > ```
> > diag(MatchedCast->getExprLoc(), "do not (implicitly) convert an array to a 
> > pointer");
> > ```
> > should I make the parenthesis conditional?
> 
> The core guideline only says to diagnose for implicit decay, so I think we 
> should not diagnose in this case.
> 
> Perhaps the wording could be, "do not implicitly decay an array into a 
> pointer; consider using gsl::array_view or an explicit decay instead"?
I posted the question here 
https://github.com/isocpp/CppCoreGuidelines/issues/352
From my understanding, explicit casts should also be forbidden for the same 
reasons that implicit decay was:
"Pointers are not arrays". If you need a pointer to the first element of an 
array, one can still use &a[0].


http://reviews.llvm.org/D13640



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

Reply via email to