diff options
| author | Steve Naroff <snaroff@apple.com> | 2008-06-03 13:21:30 +0000 |
|---|---|---|
| committer | Steve Naroff <snaroff@apple.com> | 2008-06-03 13:21:30 +0000 |
| commit | 0b225dac9b30ff21b0c5e27ab08e935c4ed10371 (patch) | |
| tree | c59534067c8e66ede098f74fbc0b407617d98f52 /clang | |
| parent | 1ba306cde501f2cf7754faa71bb1926b529a7512 (diff) | |
| download | bcm5719-llvm-0b225dac9b30ff21b0c5e27ab08e935c4ed10371.tar.gz bcm5719-llvm-0b225dac9b30ff21b0c5e27ab08e935c4ed10371.zip | |
Finish up r51900.
llvm-svn: 51901
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 9 | ||||
| -rw-r--r-- | clang/test/Sema/gcc-cast-ext.m | 18 |
2 files changed, 23 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index c978acac63d..c384a9a5a2c 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/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/clang/test/Sema/gcc-cast-ext.m b/clang/test/Sema/gcc-cast-ext.m new file mode 100644 index 00000000000..5f6aa47128b --- /dev/null +++ b/clang/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 |

