aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg')
-rw-r--r--gcc/testsuite/g++.dg/conversion/bitfield11.C8
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist7.C12
2 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/conversion/bitfield11.C b/gcc/testsuite/g++.dg/conversion/bitfield11.C
new file mode 100644
index 0000000..e36539c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/conversion/bitfield11.C
@@ -0,0 +1,8 @@
+// Make sure that digest_init converts to the declared type of the
+// bitfield, not just the lowered type.
+
+enum E { EA, EB };
+
+struct A { E e: 8; };
+
+A a = { 0 }; // { dg-error "invalid conversion" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist7.C b/gcc/testsuite/g++.dg/cpp0x/initlist7.C
new file mode 100644
index 0000000..7913ed7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist7.C
@@ -0,0 +1,12 @@
+// PR c++/37932
+// { dg-options "-std=c++0x" }
+
+typedef enum { AA=1, BB=2 } my_enum;
+
+typedef struct { my_enum a:4 ; unsigned b:28; } stru;
+
+void foo (char c, my_enum x, int i)
+{
+ char arr[2] = {c+'0', 0}; // { dg-error "narrowing" }
+ stru s = {x,0};
+}