[patch] add test for PR c++/33840

Jonathan Wakely jwakely.gcc@gmail.com
Sat Jun 4 13:00:00 GMT 2011


The code in the PR is correctly rejected now, this adds a test to
prevent regressions so the PR can be closed.

2011-06-04  Jonathan Wakely  <jwakely.gcc@gmail.com>

        PR c++/33840
        * g++.dg/diagnostic/bitfld2.C: New.


Tested x86_64-linux, ok for trunk and 4.6?
-------------- next part --------------
Index: testsuite/g++.dg/diagnostic/bitfld2.C
===================================================================
--- testsuite/g++.dg/diagnostic/bitfld2.C	(revision 0)
+++ testsuite/g++.dg/diagnostic/bitfld2.C	(revision 0)
@@ -0,0 +1,9 @@
+// PR c++/33840
+// { dg-do compile }
+
+template<int> struct A
+{
+  struct {} : 2;   // { dg-error "expected ';' after struct" }
+};
+// { dg-error "ISO C.. forbids declaration" "" { target *-*-* } 6 }
+// { dg-error "ISO C.. prohibits anonymous" "" { target *-*-* } 6 }


More information about the Gcc-patches mailing list