Commits

Anonymous committed 53bfe2a

some fixes to previous commit + test

Comments (0)

Files changed (3)

pycparser/c_parser.py

                     type=node,
                     init=None,
                     bitsize=None,
-                    coord=self._coord(p.lineno(2)))
+                    coord=self._coord(p.lineno(3)))
                 decls.append(decl)
+            else:
+                self._parse_error("Anonymous field of invalid type", 
+                    self._coord(p.lineno(3)))
         
         p[0] = decls
     

tests/test_c_parser.py

                             ['TypeDecl',
                                 ['IdentifierType', ['int']]]]]]]])
 
+        s4 = """
+            struct v {
+                int i;
+                float;
+            } v2;"""
+            
+        self.assertRaises(ParseError, self.parse, s4)
+
     def test_struct_bitfields(self):
         # a struct with two bitfields, one unnamed
         s1 = """
     {
         long sa;
         int sb;
+        float;
     };
     """