diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-01-11 18:46:21 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-01-11 18:46:21 +0000 |
commit | 58408bc4ead86b08af56cd06fc966fd858b48b2d (patch) | |
tree | 0223532edc535ef21cb0eaaf21eb8c715f4b732d /lib | |
parent | 48026d26fb58e413544874eead5491b1452e2ebf (diff) |
Tighten up the "cannot return array or function type" diagnostic to
say either "array type" or "function type", whichever it is. No reason
to make the user guess.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93164 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaType.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 499160d11f..2bddf9ecd6 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -743,7 +743,8 @@ QualType Sema::BuildFunctionType(QualType T, bool Variadic, unsigned Quals, SourceLocation Loc, DeclarationName Entity) { if (T->isArrayType() || T->isFunctionType()) { - Diag(Loc, diag::err_func_returning_array_function) << T; + Diag(Loc, diag::err_func_returning_array_function) + << T->isFunctionType() << T; return QualType(); } @@ -1045,9 +1046,11 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S, const DeclaratorChunk::FunctionTypeInfo &FTI = DeclType.Fun; // C99 6.7.5.3p1: The return type may not be a function or array type. + // For conversion functions, we'll diagnose this particular error later. if ((T->isArrayType() || T->isFunctionType()) && (D.getName().getKind() != UnqualifiedId::IK_ConversionFunctionId)) { - Diag(DeclType.Loc, diag::err_func_returning_array_function) << T; + Diag(DeclType.Loc, diag::err_func_returning_array_function) + << T->isFunctionType() << T; T = Context.IntTy; D.setInvalidType(true); } |