"non-void block should return a value")
DIAG(err_block_with_return_type_requires_args, ERROR,
"block with explicit return type requires argument list")
+DIAG(err_func_def_incomplete_result, ERROR,
+ "result type for function definition cannot be incomplete")
// Expressions.
DIAG(ext_sizeof_function_type, EXTENSION,
}
}
+ // The return type of a function definition must be complete
+ // (C99 6.9.1p3)
+ if (FD->getResultType()->isIncompleteType() &&
+ !FD->getResultType()->isVoidType()) {
+ Diag(FD->getLocation(), diag::err_func_def_incomplete_result) << FD;
+ FD->setInvalidDecl();
+ }
+
PushDeclContext(FnBodyScope, FD);
// Check the validity of our function parameters
static void f2static(int); // expected-error{{function declared in block scope cannot have 'static' storage class}}
register void f2register(int); // expected-error{{illegal storage class on function}}
}
+
+struct incomplete_test a(void) {} // expected-error{{result type for function definition cannot be incomplete}}