From: Steve Naroff Date: Tue, 3 Jun 2008 13:21:30 +0000 (+0000) Subject: Finish up r51900. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0326e045fe143856d1b2fb75ae54689e891bbc0d;p=clang Finish up r51900. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51901 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index c978acac63..c384a9a5a2 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -848,10 +848,11 @@ ActOnCastExpr(SourceLocation LParenLoc, TypeTy *Ty, if (!castType->isScalarType() && !castType->isVectorType()) { // GCC struct/union extension. if (castType == castExpr->getType() && - castType->isStructureType() || castType->isUnionType()) - return Diag(LParenLoc, diag::ext_typecheck_cast_nonscalar, - SourceRange(LParenLoc, RParenLoc)); - else + castType->isStructureType() || castType->isUnionType()) { + Diag(LParenLoc, diag::ext_typecheck_cast_nonscalar, + SourceRange(LParenLoc, RParenLoc)); + return new CastExpr(castType, castExpr, LParenLoc); + } else return Diag(LParenLoc, diag::err_typecheck_cond_expect_scalar, castType.getAsString(), SourceRange(LParenLoc, RParenLoc)); } diff --git a/test/Sema/gcc-cast-ext.m b/test/Sema/gcc-cast-ext.m new file mode 100644 index 0000000000..5f6aa47128 --- /dev/null +++ b/test/Sema/gcc-cast-ext.m @@ -0,0 +1,18 @@ +// RUN: clang %s -verify -fms-extensions +@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; +typedef struct _NSRange { } NSRange; + +@class PBXFileReference; + +@interface PBXDocBookmark ++ alloc; +- autorelease; +@end +@implementation PBXDocBookmark // expected-warning {{incomplete implementation}} expected-warning {{method definition for 'autorelease' not found}} expected-warning {{method definition for 'alloc' not found}} + ++ (id)bookmarkWithFileReference:(PBXFileReference *)fileRef gylphRange:(NSRange)range anchor:(NSString *)htmlAnchor +{ + NSRange r = (NSRange)range; + return [[[self alloc] initWithFileReference:fileRef gylphRange:(NSRange)range anchor:(NSString *)htmlAnchor] autorelease]; // expected-warning {{method '-initWithFileReference:gylphRange:anchor:' not found (return type defaults to 'id')}} +} +@end