[cfe-dev] Suggestion for array bounds warning

Marshall Clow mclow.lists at gmail.com
Tue Dec 18 08:12:57 PST 2012


If I write
	int arr[2];
	arr[2] = -1;

I get "warning: array index 2 is past end of array".
That's great.

but if I write:
	std::array<int, 2> arr;
	arr[2] = -1;

I get no warning.
I think that "it would be nice" if  clang warned in that case also.

-- Marshall

Marshall Clow     Idio Software   <mailto:mclow.lists at gmail.com>

A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
        -- Yu Suzuki





More information about the cfe-dev mailing list