vinix-ports / tests / toolchain / exceptions.cc
18 lines · 17 sloc · 403 bytes · ba8d03ddc14310e0c3928665434a6d89258b90b6
Raw
1#include <iostream>
2#include <stdexcept>
3#include <string>
4#include <vector>
5
6int main()
7{
8 const std::vector<int> values{2, 3, 5};
9 try {
10 (void)values.at(values.size());
11 } catch (const std::out_of_range& error) {
12 if (std::string(error.what()).empty())
13 return 1;
14 std::cout << "Vinix C++ exception handling passed\n";
15 return 0;
16 }
17 return 1;
18}
19