diff options
Diffstat (limited to 'TestPrograms/test_cxx11_noexcept.cxx')
-rw-r--r-- | TestPrograms/test_cxx11_noexcept.cxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/TestPrograms/test_cxx11_noexcept.cxx b/TestPrograms/test_cxx11_noexcept.cxx new file mode 100644 index 00000000..95cca1bc --- /dev/null +++ b/TestPrograms/test_cxx11_noexcept.cxx @@ -0,0 +1,18 @@ +#define GNUC_VERSION (__GNUC__*1000 + __GNUC_MAJOR__*10)
+#if (GNUC_VERSION >= 4060) || defined(__clang__)
+# pragma GCC diagnostic ignored "-Wterminate"
+#endif
+
+#include <stdexcept>
+
+void f(int n) noexcept(false)
+{
+ if (n > 2)
+ throw std::runtime_error("Oops");
+}
+
+int main(int argc, char* argv[])
+{
+ f(argc);
+ return 0;
+}
|