From 8778c28022933cada30bcb408b4ce83675e29e03 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 29 Nov 2012 16:09:03 +0000 Subject: Merge function types in C. Among other differences, GCC accepts typedef int IA[]; typedef int A10[10]; static A10 *f(void); static IA *f(void); void g(void) { (void)sizeof(*f()); } but clang used to reject it with: invalid application of 'sizeof' to an incomplete type 'IA' (aka 'int []') The intention of c99's 6.2.7 seems to be that we should use the composite type and accept as gcc does. Doing the type merging required some extra fixes: * Use the type from the function type in initializations, even if an parameter is available. * Fix the merging of the noreturn attribute in function types. * Make CodeGen handle the fact that an parameter type can be different from the corresponding type in the function type. llvm-svn: 168895 --- clang/lib/Sema/SemaExpr.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'clang/lib/Sema/SemaExpr.cpp') diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index dd1bc0b6577..f6defdaf9f9 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -3730,10 +3730,10 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc, (!Param || !Param->hasAttr())) Arg = stripARCUnbridgedCast(Arg); - InitializedEntity Entity = - Param? InitializedEntity::InitializeParameter(Context, Param) - : InitializedEntity::InitializeParameter(Context, ProtoArgType, - Proto->isArgConsumed(i)); + InitializedEntity Entity = Param ? + InitializedEntity::InitializeParameter(Context, Param, ProtoArgType) + : InitializedEntity::InitializeParameter(Context, ProtoArgType, + Proto->isArgConsumed(i)); ExprResult ArgE = PerformCopyInitialization(Entity, SourceLocation(), Owned(Arg), -- cgit v1.2.3