aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.4.0/gcc/testsuite/g++.dg/other/no-strict-enum-precision-1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.4.0/gcc/testsuite/g++.dg/other/no-strict-enum-precision-1.C')
-rw-r--r--gcc-4.4.0/gcc/testsuite/g++.dg/other/no-strict-enum-precision-1.C22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc-4.4.0/gcc/testsuite/g++.dg/other/no-strict-enum-precision-1.C b/gcc-4.4.0/gcc/testsuite/g++.dg/other/no-strict-enum-precision-1.C
new file mode 100644
index 000000000..87f263c9c
--- /dev/null
+++ b/gcc-4.4.0/gcc/testsuite/g++.dg/other/no-strict-enum-precision-1.C
@@ -0,0 +1,22 @@
+/* { dg-do run } */
+/* { dg-options "-fno-strict-enum-precision" } */
+
+enum zero_one { zero = 0, one = 1 };
+
+int* allocate_bool(zero_one e) {
+ int* v = 0;
+ switch (e) {
+ case zero: v = new int(0);
+ case one: v = new int(1);
+ }
+ return v;
+}
+
+int main() {
+ if (allocate_bool(static_cast<zero_one>(999))) {
+ /* Error: should not have matched any case label. */
+ return 1;
+ } else {
+ return 0;
+ }
+}