Added error case for inline on non-function declarations
@@ -140,6 +140,15 @@ impl<I: Iterator<Item = Lexeme>> Parser<I> {
None
}
};
+ if !symbol.ctype.is_function() && qualifiers.inline {
+ self.semantic_err(
+ format!(
+ "`inline` qualifier is only allowed on functions. hint: try defining {} as a function",
+ symbol.id
+ ),
+ id.location
+ );
+ }
if symbol.ctype.is_function() && qualifiers != Qualifiers::NONE {
warn(
&format!("{} has no effect on function return type", qualifiers),
