aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanis Johnson <janisjo@codesourcery.com>2012-07-25 22:09:28 +0000
committerJanis Johnson <janis@gcc.gnu.org>2012-07-25 22:09:28 +0000
commit1acc33406fdf0d0eec647e2e5c6d02ce67a6e50d (patch)
treeaa0d27b5f51f299fc304c8574c3abb31165e0ffd
parentb0c724c227cb3ce649f6117b89e7b84f309b889a (diff)
downloadgcc-1acc33406fdf0d0eec647e2e5c6d02ce67a6e50d.zip
gcc-1acc33406fdf0d0eec647e2e5c6d02ce67a6e50d.tar.gz
gcc-1acc33406fdf0d0eec647e2e5c6d02ce67a6e50d.tar.bz2
* g++.dg/cpp0x/nullptr21.c: Remove printfs, make self-checking.
From-SVN: r189870
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/nullptr21.C41
2 files changed, 30 insertions, 15 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 495624f..ff338d5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2012-07-25 Janis Johnson <janisjo@codesourcery.com>
+
+ * g++.dg/cpp0x/nullptr21.c: Remove printfs, make self-checking.
+
2012-07-25 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/noreturn5.ad[sb]: New test.
diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr21.C b/gcc/testsuite/g++.dg/cpp0x/nullptr21.C
index c30cb3c..8362bd2 100644
--- a/gcc/testsuite/g++.dg/cpp0x/nullptr21.C
+++ b/gcc/testsuite/g++.dg/cpp0x/nullptr21.C
@@ -3,42 +3,53 @@
// Test throw and catch
-#include <cstdio>
+extern "C" void abort (void);
typedef decltype(nullptr) nullptr_t;
+int result[2];
+
+void __attribute__((noinline))
+foo (int i, int j)
+{
+ result[i] = j;
+}
+
int main()
{
try {
throw nullptr;
} catch (void*) {
- printf("Test 1 Fail");
+ foo (0, 1);
} catch (bool) {
- printf("Test 1 Fail");
+ foo (0, 2);
} catch (int) {
- printf("Test 1 Fail");
+ foo (0, 3);
} catch (long int) {
- printf("Test 1 Fail");
+ foo (0, 4);
} catch (nullptr_t) {
- printf("Test 1 OK");
+ foo (0, 5);
} catch (...) {
- printf("Test 1 Fail");
- } // { dg-output "Test 1 OK" }
+ foo (0, 6);
+ }
nullptr_t mynull = 0;
try {
throw mynull;
} catch (void*) {
- printf("Test 2 Fail");
+ foo (1, 1);
} catch (bool) {
- printf("Test 2 Fail");
+ foo (1, 2);
} catch (int) {
- printf("Test 2 Fail");
+ foo (1, 3);
} catch (long int) {
- printf("Test 2 Fail");
+ foo (1, 4);
} catch (nullptr_t) {
- printf("Test 2 OK");
+ foo (1, 5);
} catch (...) {
- printf("Test 2 Fail");
- } // { dg-output "Test 2 OK" }
+ foo (1, 6);
+ }
+
+ if (result[0] != 5 || result[1] != 5)
+ abort ();
}