Make sure inline doesn't pass in typedefs
@@ -226,6 +226,12 @@ impl<I: Iterator<Item = Lexeme>> Parser<I> {
}
}
fn declare_typedef(&mut self, id: Locatable<InternedStr>, ctype: Type, qualifiers: Qualifiers) {
+ if qualifiers.inline {
+ self.semantic_err(
+ "`inline` is only allowed on function declarations",
+ id.location,
+ );
+ }
let typedef = Symbol {
id: id.data,
ctype: ctype.clone(),
@@ -1930,6 +1936,7 @@ mod tests {
.unwrap()
.is_err()
);
+ assert!(parse("typedef a inlint int;").unwrap().is_err());
}
#[test]
fn test_complex() {
