add test for PR c++/33840

Submitted by Jonathan Wakely on June 4, 2011, 12:59 p.m.

Details

Message ID BANLkTi=NirP0XYgu_-k1WjKJ-DWu2p2NYQ@mail.gmail.com
State New
Headers show

Commit Message

Jonathan Wakely June 4, 2011, 12:59 p.m.
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?

Comments

Jason Merrill June 4, 2011, 3:49 p.m.
OK.

Jason

Patch hide | download patch | download mbox

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 }