diff options
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/conversion/bitfield11.C | 8 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/initlist7.C | 12 |
3 files changed, 26 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index de5809e..898aaf2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2008-11-13 Jason Merrill <jason@redhat.com> + + PR c++/37932 + * g++.dg/conversion/bitfield11.C: New test. + * g++.dg/cpp0x/initlist7.C: New test. + 2008-11-13 Richard Sandiford <rdsandiford@googlemail.com> * gcc.target/mips/loongson-muldiv-1.c: New test. 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}; +} |