================
@@ -1197,6 +1197,26 @@ namespace vdtor {
static_assert(vdtor_3(3) == 3);
}
+namespace ArrayDestSize {
+ template<typename T>
+ constexpr T dynarray(int elems, int i) {
+ T *p;
+ if constexpr (sizeof(T) == 1)
+ p = new T[elems]{"fox"}; // both-note {{evaluated array bound 3 is too
small to hold 4 explicitly initialized elements}}
+ else
+ p = new T[elems]{1, 2, 3}; // both-note {{evaluated array bound 2 is too
small to hold 3 explicitly initialized elements}}
+ T n = p[i]; // both-note 4{{past-the-end}}
----------------
tbaederr wrote:
No, the past-the-end things are already properly diagnosed before.
https://github.com/llvm/llvm-project/pull/196916
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits