It is not throwing exception because you are not accessing values from vector, you are just feeding the value to i.
for (int i = 0; i <= v.size(); ++i) -- you are basically saying repeat this loop 6 times(doesn't access vector v)
for (int i = 0; i <= v.size(); ++i) {
cout << v[i] << "\n"; -- this line will throw an error because you are trying to access the values outside the range of vector v
cout << "Success\n"; -- this works because it has nothing do with vector v
}