diff options
Diffstat (limited to 'test')
42 files changed, 634 insertions, 51 deletions
diff --git a/test/Analysis/casts.c b/test/Analysis/casts.c index 94a1eac..5e4222b 100644 --- a/test/Analysis/casts.c +++ b/test/Analysis/casts.c @@ -14,3 +14,27 @@ void f(int sock) { ; } } + +struct s { + struct s *value; +}; + +int f1(struct s **pval) { + int *tbool = ((void*)0); + struct s *t = *pval; + pval = &(t->value); + tbool = (int *)pval; // Should record the cast-to type here. + char c = (unsigned char) *tbool; // Should use cast-to type to create symbol. + if (*tbool == -1) + 3; +} + +void f2(const char *str) { + unsigned char ch, cl, *p; + + p = (unsigned char *)str; + ch = *p++; // use cast-to type 'unsigned char' to create element region. + cl = *p++; + if(!cl) + cl = 'a'; +} diff --git a/test/Analysis/elementtype.c b/test/Analysis/elementtype.c new file mode 100644 index 0000000..10328e6 --- /dev/null +++ b/test/Analysis/elementtype.c @@ -0,0 +1,13 @@ +// RUN: clang-cc -analyze -checker-simple -analyzer-store=region %s + +typedef struct added_obj_st { + int type; +} ADDED_OBJ; + +// Test if we are using the canonical type for ElementRegion. +void f() { + ADDED_OBJ *ao[4]={((void*)0),((void*)0),((void*)0),((void*)0)}; + if (ao[0] != ((void*)0)) { + ao[0]->type=0; + } +} diff --git a/test/Analysis/fields.c b/test/Analysis/fields.c index c012a9d..900a6d6 100644 --- a/test/Analysis/fields.c +++ b/test/Analysis/fields.c @@ -8,3 +8,12 @@ void bar() { *(unsigned*)&y = foo(); y.x = 1; } + +struct s { + int n; +}; + +void f() { + struct s a; + int *p = &(a.n) + 1; +} diff --git a/test/Analysis/func.c b/test/Analysis/func.c index ac067a9..a018d0a 100644 --- a/test/Analysis/func.c +++ b/test/Analysis/func.c @@ -1,4 +1,5 @@ // RUN: clang-cc -analyze -checker-simple -verify %s && +// RUN: clang-cc -analyze -checker-simple -analyzer-store=region -verify %s && // RUN: clang-cc -analyze -checker-cfref -analyzer-store=basic -verify %s && // RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s diff --git a/test/Analysis/retain-release.m b/test/Analysis/retain-release.m index c7c5e24..da0ae80 100644 --- a/test/Analysis/retain-release.m +++ b/test/Analysis/retain-release.m @@ -10,19 +10,23 @@ // #include <DiskArbitration/DiskArbitration.h> // #include <QuartzCore/QuartzCore.h> // #include <Quartz/Quartz.h> +// #include <IOKit/IOKitLib.h> // // It includes the basic definitions for the test cases below. //===----------------------------------------------------------------------===// typedef unsigned int __darwin_natural_t; +typedef unsigned long uintptr_t; +typedef unsigned int uint32_t; +typedef unsigned long long uint64_t; typedef unsigned int UInt32; typedef signed long CFIndex; typedef const void * CFTypeRef; typedef const struct __CFString * CFStringRef; typedef const struct __CFAllocator * CFAllocatorRef; +extern const CFAllocatorRef kCFAllocatorDefault; extern CFTypeRef CFRetain(CFTypeRef cf); extern void CFRelease(CFTypeRef cf); -extern const CFAllocatorRef kCFAllocatorDefault; typedef struct { } CFArrayCallBacks; @@ -33,6 +37,7 @@ extern CFMutableArrayRef CFArrayCreateMutable(CFAllocatorRef allocator, CFIndex extern const void *CFArrayGetValueAtIndex(CFArrayRef theArray, CFIndex idx); extern void CFArrayAppendValue(CFMutableArrayRef theArray, const void *value); typedef const struct __CFDictionary * CFDictionaryRef; +typedef struct __CFDictionary * CFMutableDictionaryRef; typedef UInt32 CFStringEncoding; enum { kCFStringEncodingMacRoman = 0, kCFStringEncodingWindowsLatin1 = 0x0500, kCFStringEncodingISOLatin1 = 0x0201, kCFStringEncodingNextStepLatin = 0x0B01, kCFStringEncodingASCII = 0x0600, kCFStringEncodingUnicode = 0x0100, kCFStringEncodingUTF8 = 0x08000100, kCFStringEncodingNonLossyASCII = 0x0BFF , kCFStringEncodingUTF16 = 0x0100, kCFStringEncodingUTF16BE = 0x10000100, kCFStringEncodingUTF16LE = 0x14000100, kCFStringEncodingUTF32 = 0x0c000100, kCFStringEncodingUTF32BE = 0x18000100, kCFStringEncodingUTF32LE = 0x1c000100 }; @@ -42,9 +47,7 @@ typedef CFTimeInterval CFAbsoluteTime; extern CFAbsoluteTime CFAbsoluteTimeGetCurrent(void); typedef const struct __CFDate * CFDateRef; extern CFDateRef CFDateCreate(CFAllocatorRef allocator, CFAbsoluteTime at); -CFAbsoluteTime CFDateGetAbsoluteTime(CFDateRef theDate); -enum { -kCFCalendarComponentsWrap = (1UL << 0) }; +extern CFAbsoluteTime CFDateGetAbsoluteTime(CFDateRef theDate); typedef __darwin_natural_t natural_t; typedef natural_t mach_port_name_t; typedef mach_port_name_t mach_port_t; @@ -52,6 +55,8 @@ typedef int kern_return_t; typedef kern_return_t mach_error_t; typedef signed char BOOL; typedef unsigned long NSUInteger; +@class NSString, Protocol; +extern void NSLog(NSString *format, ...) __attribute__((format(__NSString__, 1, 2))); typedef struct _NSZone NSZone; @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; @protocol NSObject - (BOOL)isEqual:(id)object; @@ -71,32 +76,54 @@ typedef struct { } NSFastEnumerationState; @protocol NSFastEnumeration - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len; -@end @interface NSArray : NSObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration> - (NSUInteger)count; +@end @class NSString; +@interface NSArray : NSObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration> - (NSUInteger)count; @end @interface NSArray (NSArrayCreation) + (id)array; -@end @interface NSAutoreleasePool : NSObject { +@end @interface NSAutoreleasePool : NSObject { } - (void)drain; -@end typedef double NSTimeInterval; +@end extern NSString * const NSBundleDidLoadNotification; +typedef double NSTimeInterval; @interface NSDate : NSObject <NSCopying, NSCoding> - (NSTimeInterval)timeIntervalSinceReferenceDate; -@end enum { -NSWrapCalendarComponents = kCFCalendarComponentsWrap, }; +@end typedef unsigned short unichar; @interface NSString : NSObject <NSCopying, NSMutableCopying, NSCoding> - (NSUInteger)length; - ( const char *)UTF8String; - (id)initWithUTF8String:(const char *)nullTerminatedCString; + (id)stringWithUTF8String:(const char *)nullTerminatedCString; -@end @interface NSData : NSObject <NSCopying, NSMutableCopying, NSCoding> - (NSUInteger)length; +@end @class NSString, NSData; +@interface NSData : NSObject <NSCopying, NSMutableCopying, NSCoding> - (NSUInteger)length; + (id)dataWithBytesNoCopy:(void *)bytes length:(NSUInteger)length; + (id)dataWithBytesNoCopy:(void *)bytes length:(NSUInteger)length freeWhenDone:(BOOL)b; -@end @interface NSDictionary : NSObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration> - (NSUInteger)count; +@end @class NSString; +@interface NSDictionary : NSObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration> - (NSUInteger)count; @end @interface NSMutableDictionary : NSDictionary - (void)removeObjectForKey:(id)aKey; - (void)setObject:(id)anObject forKey:(id)aKey; @end @interface NSMutableDictionary (NSMutableDictionaryCreation) + (id)dictionaryWithCapacity:(NSUInteger)numItems; +@end typedef double CGFloat; +struct CGSize { +}; +typedef struct CGSize CGSize; struct CGRect { }; typedef struct CGRect CGRect; +@protocol NSLocking - (void)lock; - (id)init; +@end @class NSURLAuthenticationChallenge; typedef mach_port_t io_object_t; +typedef char io_name_t[128]; +typedef io_object_t io_iterator_t; typedef io_object_t io_service_t; +typedef struct IONotificationPort * IONotificationPortRef; +typedef void (*IOServiceMatchingCallback)( void * refcon, io_iterator_t iterator ); +io_service_t IOServiceGetMatchingService( mach_port_t masterPort, CFDictionaryRef matching ); +kern_return_t IOServiceGetMatchingServices( mach_port_t masterPort, CFDictionaryRef matching, io_iterator_t * existing ); +kern_return_t IOServiceAddNotification( mach_port_t masterPort, const io_name_t notificationType, CFDictionaryRef matching, mach_port_t wakePort, uintptr_t reference, io_iterator_t * notification ) __attribute__((deprecated)); +kern_return_t IOServiceAddMatchingNotification( IONotificationPortRef notifyPort, const io_name_t notificationType, CFDictionaryRef matching, IOServiceMatchingCallback callback, void * refCon, io_iterator_t * notification ); +CFMutableDictionaryRef IOServiceMatching( const char * name ); +CFMutableDictionaryRef IOServiceNameMatching( const char * name ); +CFMutableDictionaryRef IOBSDNameMatching( mach_port_t masterPort, uint32_t options, const char * bsdName ); +CFMutableDictionaryRef IOOpenFirmwarePathMatching( mach_port_t masterPort, uint32_t options, const char * path ); +CFMutableDictionaryRef IORegistryEntryIDMatching( uint64_t entryID ); typedef struct __DASession * DASessionRef; extern DASessionRef DASessionCreate( CFAllocatorRef allocator ); typedef struct __DADisk * DADiskRef; @@ -106,18 +133,26 @@ extern CFDictionaryRef DADiskCopyDescription( DADiskRef disk ); extern DADiskRef DADiskCopyWholeDisk( DADiskRef disk ); typedef struct CGColorSpace *CGColorSpaceRef; typedef struct CGImage *CGImageRef; -@end @class CIContext; -@class NSArray, NSError, NSEvent, NSMenu, NSUndoManager, NSWindow; + typedef struct CGLayer *CGLayerRef; + @class NSArray, NSError, NSEvent, NSMenu, NSUndoManager, NSWindow; @interface NSResponder : NSObject <NSCoding> { } @end @protocol NSAnimatablePropertyContainer - (id)animator; @end extern NSString *NSAnimationTriggerOrderIn ; @interface NSView : NSResponder <NSAnimatablePropertyContainer> { +struct __VFlags2 { } -@end @class NSColor, NSFont, NSNotification; -@protocol NSValidatedUserInterfaceItem - (SEL)action; +_vFlags2; +} +@end extern NSString * const NSFullScreenModeAllScreens; +@protocol NSChangeSpelling - (void)changeSpelling:(id)sender; +@end @protocol NSIgnoreMisspelledWords - (void)ignoreSpelling:(id)sender; +@end @class NSColor, NSFont, NSNotification; +@interface NSText : NSView <NSChangeSpelling, NSIgnoreMisspelledWords> { +} +@end @protocol NSValidatedUserInterfaceItem - (SEL)action; @end @protocol NSUserInterfaceValidations - (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)anItem; -@end typedef struct NSThreadPrivate _NSThreadPrivate; +@end @class NSArray, NSError, NSImage, NSView, NSNotificationCenter, NSURL, NSScreen, NSRunningApplication; @interface NSApplication : NSResponder <NSUserInterfaceValidations> { } @end enum { @@ -125,15 +160,12 @@ NSTerminateCancel = 0, NSTerminateNow = 1, NSTerminateLater = 2 typedef NSUInteger NSApplicationTerminateReply; @protocol NSApplicationDelegate <NSObject> @optional - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender; @end enum { -NSUserInterfaceLayoutDirectionLeftToRight = 0, NSUserInterfaceLayoutDirectionRightToLeft = 1 }; +} +_CFlags; @interface CIImage : NSObject <NSCoding, NSCopying> { } typedef int CIFormat; -typedef struct __SFlags { -} -_SFlags; -@end extern NSString * const kCAGravityCenter __attribute__((visibility("default"))); -enum { +@end enum { kDAReturnSuccess = 0, kDAReturnError = (((0x3e)&0x3f)<<26) | (((0x368)&0xfff)<<14) | 0x01, kDAReturnBusy = (((0x3e)&0x3f)<<26) | (((0x368)&0xfff)<<14) | 0x02, kDAReturnBadArgument = (((0x3e)&0x3f)<<26) | (((0x368)&0xfff)<<14) | 0x03, kDAReturnExclusiveAccess = (((0x3e)&0x3f)<<26) | (((0x368)&0xfff)<<14) | 0x04, kDAReturnNoResources = (((0x3e)&0x3f)<<26) | (((0x368)&0xfff)<<14) | 0x05, kDAReturnNotFound = (((0x3e)&0x3f)<<26) | (((0x368)&0xfff)<<14) | 0x06, kDAReturnNotMounted = (((0x3e)&0x3f)<<26) | (((0x368)&0xfff)<<14) | 0x07, kDAReturnNotPermitted = (((0x3e)&0x3f)<<26) | (((0x368)&0xfff)<<14) | 0x08, kDAReturnNotPrivileged = (((0x3e)&0x3f)<<26) | (((0x368)&0xfff)<<14) | 0x09, kDAReturnNotReady = (((0x3e)&0x3f)<<26) | (((0x368)&0xfff)<<14) | 0x0A, kDAReturnNotWritable = (((0x3e)&0x3f)<<26) | (((0x368)&0xfff)<<14) | 0x0B, kDAReturnUnsupported = (((0x3e)&0x3f)<<26) | (((0x368)&0xfff)<<14) | 0x0C }; typedef mach_error_t DAReturn; typedef const struct __DADissenter * DADissenterRef; @@ -142,15 +174,25 @@ extern DADissenterRef DADissenterCreate( CFAllocatorRef allocator, DAReturn stat } - (CGImageRef)createCGImage:(CIImage *)im fromRect:(CGRect)r; - (CGImageRef)createCGImage:(CIImage *)im fromRect:(CGRect)r format:(CIFormat)f colorSpace:(CGColorSpaceRef)cs; -@end @protocol QCCompositionRenderer @end @interface QCRenderer : NSObject <QCCompositionRenderer> { +- (CGLayerRef)createCGLayerWithSize:(CGSize)size info:(CFDictionaryRef)d; +@end @class NSURL; +@protocol QCCompositionRenderer - (NSDictionary*) attributes; +@end @interface QCRenderer : NSObject <QCCompositionRenderer> { } - (id) createSnapshotImageOfType:(NSString*)type; -@end @interface QCView : NSView <QCCompositionRenderer> { +@end extern NSString* const QCViewDidStartRenderingNotification; +@interface QCView : NSView <QCCompositionRenderer> { } - (id) createSnapshotImageOfType:(NSString*)type; +@end enum { +ICEXIFOrientation1 = 1, ICEXIFOrientation2 = 2, ICEXIFOrientation3 = 3, ICEXIFOrientation4 = 4, ICEXIFOrientation5 = 5, ICEXIFOrientation6 = 6, ICEXIFOrientation7 = 7, ICEXIFOrientation8 = 8, }; +@class ICDevice; +@protocol ICDeviceDelegate <NSObject> @required - (void)didRemoveDevice:(ICDevice*)device; +@end @class ICCameraDevice; +@class ICScannerDevice; +@protocol ICScannerDeviceDelegate <ICDeviceDelegate> @optional - (void)scannerDeviceDidBecomeAvailable:(ICScannerDevice*)scanner; @end -extern void NSLog(NSString *format, ...) __attribute__((format(__NSString__, 1, 2))); - + //===----------------------------------------------------------------------===// // Test cases. //===----------------------------------------------------------------------===// @@ -683,6 +725,72 @@ void rdar6902710(QCView *view, QCRenderer *renderer, CIContext *context, } //===----------------------------------------------------------------------===// +// <rdar://problem/6945561> -[CIContext createCGLayerWithSize:info:] +// misinterpreted by clang scan-build +//===----------------------------------------------------------------------===// + +void rdar6945561(CIContext *context, CGSize size, CFDictionaryRef d) { + [context createCGLayerWithSize:size info:d]; // expected-warning{{leak}} +} + +//===----------------------------------------------------------------------===// +// <rdar://problem/6961230> add knowledge of IOKit functions to retain/release +// checker +//===----------------------------------------------------------------------===// + +void IOBSDNameMatching_wrapper(mach_port_t masterPort, uint32_t options, const char * bsdName) { + IOBSDNameMatching(masterPort, options, bsdName); // expected-warning{{leak}} +} + +void IOServiceMatching_wrapper(const char * name) { + IOServiceMatching(name); // expected-warning{{leak}} +} + +void IOServiceNameMatching_wrapper(const char * name) { + IOServiceNameMatching(name); // expected-warning{{leak}} +} + +__attribute__((cf_returns_retained)) CFDictionaryRef CreateDict(); + +void IOServiceAddNotification_wrapper(mach_port_t masterPort, const io_name_t notificationType, + mach_port_t wakePort, uintptr_t reference, io_iterator_t * notification ) { + + CFDictionaryRef matching = CreateDict(); + CFRelease(matching); + IOServiceAddNotification(masterPort, notificationType, matching, // expected-warning{{used after it is released}} expected-warning{{deprecated}} + wakePort, reference, notification); +} + +void IORegistryEntryIDMatching_wrapper(uint64_t entryID ) { + IORegistryEntryIDMatching(entryID); // expected-warning{{leak}} +} + +void IOOpenFirmwarePathMatching_wrapper(mach_port_t masterPort, uint32_t options, + const char * path) { + IOOpenFirmwarePathMatching(masterPort, options, path); // expected-warning{{leak}} +} + +void IOServiceGetMatchingService_wrapper(mach_port_t masterPort) { + CFDictionaryRef matching = CreateDict(); + IOServiceGetMatchingService(masterPort, matching); + CFRelease(matching); // expected-warning{{used after it is released}} +} + +void IOServiceGetMatchingServices_wrapper(mach_port_t masterPort, io_iterator_t *existing) { + CFDictionaryRef matching = CreateDict(); + IOServiceGetMatchingServices(masterPort, matching, existing); + CFRelease(matching); // expected-warning{{used after it is released}} +} + +void IOServiceAddMatchingNotification_wrapper(IONotificationPortRef notifyPort, const io_name_t notificationType, + IOServiceMatchingCallback callback, void * refCon, io_iterator_t * notification) { + + CFDictionaryRef matching = CreateDict(); + IOServiceAddMatchingNotification(notifyPort, notificationType, matching, callback, refCon, notification); + CFRelease(matching); // expected-warning{{used after it is released}} +} + +//===----------------------------------------------------------------------===// // Tests of ownership attributes. //===----------------------------------------------------------------------===// diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index ba5a025..7521a1d 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,13 +1,10 @@ -find_file(CLANG_TEST_RUNNER TestRunner.sh PATHS ${CMAKE_CURRENT_SOURCE_DIR} - DOC "Clang's regression testing script") -mark_as_advanced(CLANG_TEST_RUNNER) - set(CLANG_TEST_DIRECTORIES "Analysis" "CodeGen" "CodeGenCXX" "CodeGenObjC" "Coverage" + "CXX" "Driver" "FixIt" "Frontend" @@ -28,14 +25,20 @@ if(PYTHONINTERP_FOUND) get_target_property(LLVM_TOOLS_PATH clang RUNTIME_OUTPUT_DIRECTORY) set(TESTING_EXTRA_PATHS "${LLVM_TOOLS_PATH}/${CMAKE_CFG_INTDIR}:${LLVM_SOURCE_DIR}/test/Scripts") + set(CLANG_TEST_EXTRA_ARGS) + if (MSVC OR XCODE) + set(CLANG_TEST_EXTRA_ARGS "--no-progress-bar") + endif() set(all_testdirs) - foreach(testdir ${CLANG_TEST_DIRECTORIES}) + foreach(testdir ${CLANG_TEST_DIRECTORIES}) add_custom_target(clang-test-${testdir} ${PYTHON_EXECUTABLE} ${LLVM_SOURCE_DIR}/tools/clang/utils/test/MultiTestRunner.py - -s - "--path=${TESTING_EXTRA_PATHS}" - ${CMAKE_CURRENT_SOURCE_DIR}/${testdir}/ + "--path=${TESTING_EXTRA_PATHS}" + -s ${CLANG_TEST_EXTRA_ARGS} + --clang=${LLVM_TOOLS_PATH}/${CMAKE_CFG_INTDIR}/clang + --clang-cc=${LLVM_TOOLS_PATH}/${CMAKE_CFG_INTDIR}/clang-cc + ${CMAKE_CURRENT_SOURCE_DIR}/${testdir}/ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Running Clang regression tests in ${testdir}") @@ -46,6 +49,9 @@ if(PYTHONINTERP_FOUND) ${PYTHON_EXECUTABLE} ${LLVM_SOURCE_DIR}/tools/clang/utils/test/MultiTestRunner.py "--path=${TESTING_EXTRA_PATHS}" + -s ${CLANG_TEST_EXTRA_ARGS} + --clang=${LLVM_TOOLS_PATH}/${CMAKE_CFG_INTDIR}/clang + --clang-cc=${LLVM_TOOLS_PATH}/${CMAKE_CFG_INTDIR}/clang-cc ${all_testdirs} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS clang clang-cc diff --git a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p11.cpp b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p11.cpp new file mode 100644 index 0000000..1b56ecd --- /dev/null +++ b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p11.cpp @@ -0,0 +1,12 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +static const int a = 10; + +void f0(int a, + int b = a) { // expected-error {{default argument references parameter 'a'}} +} + +template<int a, + int b = a> +class A { +}; diff --git a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p12.cpp b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p12.cpp new file mode 100644 index 0000000..aee8acf --- /dev/null +++ b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p12.cpp @@ -0,0 +1,13 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +struct S {}; +S E0; + +namespace { + enum { + E0 = 1, + E1 = E0 + 1 + }; +} + + diff --git a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p13.cpp b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p13.cpp new file mode 100644 index 0000000..afd6623 --- /dev/null +++ b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p13.cpp @@ -0,0 +1,8 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +struct S { + static const int f0 = 0; + static int f1; +}; + +int S::f1 = f0; diff --git a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp new file mode 100644 index 0000000..b9b136c --- /dev/null +++ b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp @@ -0,0 +1,11 @@ +// RUN: clang-cc -fsyntax-only -verify %s +// XFAIL + +namespace N { + struct S {}; + S i; + extern S j; +} + +int i = 2; +N::S N::j = i; diff --git a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p15.cpp b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p15.cpp new file mode 100644 index 0000000..9572aaa --- /dev/null +++ b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p15.cpp @@ -0,0 +1,17 @@ +// RUN: clang-cc -fsyntax-only -verify %s +// XFAIL + +class C { +public: + C(int a, int b); +}; + +C::C(int a, // expected-note {{previous definition}} + int b) // expected-note {{previous definition}} +try { + int c; + +} catch (int a) { // expected-error {{redefinition of 'a'}} + int b; // expected-error {{redefinition of 'b'}} + ++c; // expected-error {{use of undeclared identifion 'c'}} +} diff --git a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p3.cpp b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p3.cpp new file mode 100644 index 0000000..1daf0dd --- /dev/null +++ b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p3.cpp @@ -0,0 +1,26 @@ +// RUN: clang-cc -fsyntax-only -verify %s +// XFAIL + +// FIXME: This part is here to demonstrate the failure in looking up 'f', it can +// be removed once the whole test passes. +typedef int f; +namespace N0 { + struct A { + friend void f(); + void g() { + int i = f(1); + } + }; +} + +namespace N1 { + struct A { + friend void f(A &); + operator int(); + void g(A a) { + // ADL should not apply to the lookup of 'f', it refers to the typedef + // above. + int i = f(a); + } + }; +} diff --git a/test/CodeGen/2009-05-22-callingconv.c b/test/CodeGen/2009-05-22-callingconv.c index 2b70d84..8afc656 100644 --- a/test/CodeGen/2009-05-22-callingconv.c +++ b/test/CodeGen/2009-05-22-callingconv.c @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -emit-llvm -o - | grep call | grep x86_stdcallcc +// RUN: clang-cc %s -emit-llvm -o - -triple i386-unknown-unknown | grep call | grep x86_stdcallcc void abort(void) __attribute__((__noreturn__)); typedef void re_string_t; typedef void re_dfa_t; diff --git a/test/CodeGen/2009-06-14-anonymous-union-init.c b/test/CodeGen/2009-06-14-anonymous-union-init.c new file mode 100644 index 0000000..8d1831a --- /dev/null +++ b/test/CodeGen/2009-06-14-anonymous-union-init.c @@ -0,0 +1,7 @@ +// RUN: clang-cc -emit-llvm < %s | grep "zeroinitializer, i16 16877" +// PR4390 +struct sysfs_dirent { + union { struct sysfs_elem_dir {} s_dir; }; + unsigned short s_mode; +}; +struct sysfs_dirent sysfs_root = { {}, 16877 }; diff --git a/test/CodeGen/2009-06-16-inc_test.c b/test/CodeGen/2009-06-16-inc_test.c new file mode 100644 index 0000000..b28f63a --- /dev/null +++ b/test/CodeGen/2009-06-16-inc_test.c @@ -0,0 +1,3 @@ +// RUN: clang -c -g %s -o /dev/null +// PR 4228 +#include "2009-06-16-test.c" diff --git a/test/CodeGen/2009-06-16-test.c b/test/CodeGen/2009-06-16-test.c new file mode 100644 index 0000000..4189d06 --- /dev/null +++ b/test/CodeGen/2009-06-16-test.c @@ -0,0 +1,15 @@ + +#ifndef TEST +#define TEST +#define INSIDE_RECURSION +#include "2009-06-16-test.c" +#undef INSIDE_RECURSION +#endif + +#ifndef INSIDE_RECURSION +int i; +#endif + +#ifdef INSIDE_RECURSION +int j; +#endif diff --git a/test/CodeGen/call-knr-indirect.c b/test/CodeGen/call-knr-indirect.c new file mode 100644 index 0000000..17be015 --- /dev/null +++ b/test/CodeGen/call-knr-indirect.c @@ -0,0 +1,11 @@ +// RUN: clang %s -O0 -emit-llvm -S -o - | grep 'call.*rb_define_global_function' +// This should call rb_define_global_function, not rb_f_chop. + +void rb_define_global_function (const char*,void(*)(),int); +static void rb_f_chop(); +void Init_String() { + rb_define_global_function("chop", rb_f_chop, 0); +} +static void rb_f_chop() { +} + diff --git a/test/CodeGen/libcalls.c b/test/CodeGen/libcalls.c index 6953216..ea9e0c3 100644 --- a/test/CodeGen/libcalls.c +++ b/test/CodeGen/libcalls.c @@ -1,7 +1,7 @@ -// RUN: clang-cc -fmath-errno=1 -emit-llvm -o %t %s && +// RUN: clang-cc -fmath-errno=1 -emit-llvm -o %t %s -triple i386-unknown-unknown && // RUN: grep "declare " %t | count 6 && // RUN: grep "declare " %t | grep "@llvm." | count 1 && -// RUN: clang-cc -fmath-errno=0 -emit-llvm -o %t %s && +// RUN: clang-cc -fmath-errno=0 -emit-llvm -o %t %s -triple i386-unknown-unknown && // RUN: grep "declare " %t | count 6 && // RUN: grep "declare " %t | grep -v "@llvm." | count 0 diff --git a/test/CodeGenCXX/default-arg-temps.cpp b/test/CodeGenCXX/default-arg-temps.cpp new file mode 100644 index 0000000..2dcf773 --- /dev/null +++ b/test/CodeGenCXX/default-arg-temps.cpp @@ -0,0 +1,15 @@ +// RUN: clang-cc -emit-llvm %s -o %t -triple=x86_64-apple-darwin9 && + +struct T { + T(); + ~T(); +}; + +void f(const T& t = T()); + +void g() { + // RUN: grep "call void @_ZN1TC1Ev" %t | count 2 && + // RUN: grep "call void @_ZN1TD1Ev" %t | count 2 + f(); + f(); +} diff --git a/test/CodeGenObjC/encode-test-5.m b/test/CodeGenObjC/encode-test-5.m index a76b071..9820b41 100644 --- a/test/CodeGenObjC/encode-test-5.m +++ b/test/CodeGenObjC/encode-test-5.m @@ -1,12 +1,12 @@ // RUN: clang-cc -triple=x86_64-apple-darwin9 -fnext-runtime -emit-llvm -o %t %s && -// RUN: grep ji %t | count 1 && +// RUN: grep ji.00 %t | count 1 && char *a = @encode(_Complex int); -// RUN: grep jf %t | count 1 && +// RUN: grep jf.00 %t | count 1 && char *b = @encode(_Complex float); -// RUN: grep jd %t | count 1 && +// RUN: grep jd.00 %t | count 1 && char *c = @encode(_Complex double); // RUN: grep "t.00" %t | count 1 && diff --git a/test/Driver/analyze.c b/test/Driver/analyze.c index 338c614..5ca890f 100644 --- a/test/Driver/analyze.c +++ b/test/Driver/analyze.c @@ -1,9 +1,9 @@ // Verify that the analyzer gets the same flags as normal compilation // (at least for a few key ones). -// RUN: clang -ccc-host-triple i386-apple-darwin9 -### --analyze -o /dev/null %s -msse 2> %t.log && +// RUN: env MACOSX_DEPLOYMENT_TARGET=10.5 clang -ccc-host-triple i386-apple-darwin9 -### --analyze -o /dev/null %s -msse 2> %t.log && // RUN: grep '"-analyze"' %t.log && // RUN: grep '"--fmath-errno=0"' %t.log && // RUN: grep '"-target-feature" "+sse"' %t.log && -// RUN: grep '"-mmacosx-version-min=10.5.0"' %t.log +// RUN: grep '"-mmacosx-version-min=10.5"' %t.log diff --git a/test/Driver/darwin-cc.c b/test/Driver/darwin-cc.c index 77193cd..ac5d9a9 100644 --- a/test/Driver/darwin-cc.c +++ b/test/Driver/darwin-cc.c @@ -1,3 +1,4 @@ +// RUN: unset MACOSX_DEPLOYMENT_TARGET && // RUN: clang -ccc-no-clang -ccc-host-triple i386-apple-darwin10 -m32 -### -MD -g -fast -Q -dA -mkernel -ansi -aFOO -S -o /tmp/OUTPUTNAME -g0 -gfull -O2 -Werror -pedantic -Wmost -w -std=c99 -trigraphs -v -pg -fFOO -undef -Qn --param a=b -fmudflap -coverage -save-temps -nostdinc -I ARG0 -F ARG1 -I ARG2 -P -MF ARG3 -MG -MP -remap -g3 -H -D ARG4 -U ARG5 -A ARG6 -D ARG7 -U ARG8 -A ARG9 -include ARG10 -pthread %s 2> %t.log && // RUN: grep ' ".*cc1" "-E" "-nostdinc" "-v" "-I" "ARG0" "-F" "ARG1" "-I" "ARG2" "-P" "-MD" "/tmp/OUTPUTNAME.d" "-MF" "ARG3" "-MG" "-MP" "-MQ" "/tmp/OUTPUTNAME" "-remap" "-dD" "-H" "-D__STATIC__" "-D_REENTRANT" "-D" "ARG4" "-U" "ARG5" "-A" "ARG6" "-D" "ARG7" "-U" "ARG8" "-A" "ARG9" "-include" "ARG10" ".*darwin-cc.c" "-D_MUDFLAP" "-include" "mf-runtime.h" "-mmacosx-version-min=10.6.0" "-m32" "-mkernel" "-mtune=core2" "-ansi" "-std=c99" "-trigraphs" "-Werror" "-pedantic" "-Wmost" "-w" "-fast" "-fno-eliminate-unused-debug-symbols" "-fFOO" "-fmudflap" "-O2" "-undef" "-fpch-preprocess" "-o" ".*darwin-cc.i"' %t.log && // RUN: grep ' ".*cc1" "-fpreprocessed" ".*darwin-cc.i" "-O3" "-dumpbase" ".*darwin-cc.c" "-dA" "-mmacosx-version-min=10.6.0" "-m32" "-mkernel" "-mtune=core2" "-ansi" "-aFOO" "-auxbase-strip" "/tmp/OUTPUTNAME" "-g" "-g0" "-g" "-g3" "-O2" "-Werror" "-pedantic" "-Wmost" "-w" "-ansi" "-std=c99" "-trigraphs" "-version" "-p" "-fast" "-fno-eliminate-unused-debug-symbols" "-fFOO" "-fmudflap" "-undef" "-fno-ident" "-o" "/tmp/OUTPUTNAME" "--param" "a=b" "-fno-builtin" "-fno-merge-constants" "-fprofile-arcs" "-ftest-coverage"' %t.log && diff --git a/test/Driver/darwin-ld.c b/test/Driver/darwin-ld.c index 5ac5ae3..2e6fc57 100644 --- a/test/Driver/darwin-ld.c +++ b/test/Driver/darwin-ld.c @@ -1,5 +1,6 @@ // Check that ld gets arch_multiple. +// RUN: unset MACOSX_DEPLOYMENT_TARGET && // RUN: clang -ccc-host-triple i386-apple-darwin9 -arch i386 -arch x86_64 %s -### -o foo 2> %t.log && // RUN: grep '".*ld" .*"-arch_multiple" "-final_output" "foo"' %t.log && diff --git a/test/Driver/default-toolchain.c b/test/Driver/default-toolchain.c new file mode 100644 index 0000000..216394f --- /dev/null +++ b/test/Driver/default-toolchain.c @@ -0,0 +1,8 @@ +// RUN: clang -ccc-host-triple i386-unknown-unknown -m64 -v 2> %t +// RUN: grep 'Target: x86_64-unknown-unknown' %t && + +// RUN: clang -ccc-host-triple i386-apple-darwin9 -arch ppc -m64 -v 2> %t +// RUN: grep 'Target: powerpc64-apple-darwin9' %t && + +// RUN: clang -ccc-host-triple i386-apple-darwin9 -arch ppc64 -m32 -v 2> %t +// RUN: grep 'Target: powerpc-apple-darwin9' %t diff --git a/test/Lexer/token-concat-2.c b/test/Lexer/token-concat-2.c new file mode 100644 index 0000000..2891654 --- /dev/null +++ b/test/Lexer/token-concat-2.c @@ -0,0 +1,4 @@ +// RUN: clang-cc -E -x c -o - %s | grep '[.][*]' +// PR4395 +#define X .* +X diff --git a/test/Parser/cxx-template-decl.cpp b/test/Parser/cxx-template-decl.cpp index ae5d8f9..75b26a9 100644 --- a/test/Parser/cxx-template-decl.cpp +++ b/test/Parser/cxx-template-decl.cpp @@ -66,6 +66,17 @@ class T { // expected-error{{declaration of 'T' shadows template parameter}} template<int Size> // expected-note{{template parameter is declared here}} void shadow3(int Size); // expected-error{{declaration of 'Size' shadows template parameter}} +// <rdar://problem/6952203> +template<typename T> // expected-note{{here}} +struct shadow4 { + int T; // expected-error{{shadows}} +}; + +template<typename T> // expected-note{{here}} +struct shadow5 { + int T(int, float); // expected-error{{shadows}} +}; + // Non-type template parameters in scope template<int Size> void f(int& i) { diff --git a/test/Parser/cxx-using-declaration.cpp b/test/Parser/cxx-using-declaration.cpp new file mode 100644 index 0000000..de0e6f1 --- /dev/null +++ b/test/Parser/cxx-using-declaration.cpp @@ -0,0 +1,45 @@ +// RUN: clang-cc -fsyntax-only -verify %s
+
+namespace A {
+ int VA;
+ void FA() {}
+ struct SA { int V; };
+}
+
+using A::VA;
+using A::FA;
+using typename A::SA;
+
+void main()
+{
+ VA = 1;
+ FA();
+ SA x; //Still needs handling.
+}
+
+struct B {
+ void f(char){};
+ void g(char){};
+};
+struct D : B {
+ using B::f;
+ void f(int);
+ void g(int);
+};
+void D::f(int) { f('c'); } // calls B::f(char)
+void D::g(int) { g('c'); } // recursively calls D::g(int)
+
+namespace E {
+ template <typename TYPE> int funcE(TYPE arg) { return(arg); }
+}
+
+using E::funcE<int>; // expected-error{{use of template specialization in using directive not allowed}}
+
+namespace F {
+ struct X;
+}
+
+using F::X;
+// Should have some errors here. Waiting for implementation.
+void X(int);
+struct X *x;
diff --git a/test/Parser/cxx-using-directive.cpp b/test/Parser/cxx-using-directive.cpp index 676f4e6..504d026 100644 --- a/test/Parser/cxx-using-directive.cpp +++ b/test/Parser/cxx-using-directive.cpp @@ -13,8 +13,7 @@ namespace D { class C { - using namespace B ; // expected-error{{expected member name or ';' after declaration specifiers}} - //FIXME: this needs better error message + using namespace B ; // expected-error{{not allowed}} }; namespace B {} diff --git a/test/Parser/namespace-alias-attr.cpp b/test/Parser/namespace-alias-attr.cpp new file mode 100644 index 0000000..9e4072c --- /dev/null +++ b/test/Parser/namespace-alias-attr.cpp @@ -0,0 +1,8 @@ +// RUN: clang-cc -verify %s + +namespace A +{ +} + +namespace B __attribute__ (( static )) = A; // expected-error{{attributes can not be specified on namespace alias}} + diff --git a/test/Preprocessor/_Pragma-dependency2.c b/test/Preprocessor/_Pragma-dependency2.c new file mode 100644 index 0000000..c21c7c8 --- /dev/null +++ b/test/Preprocessor/_Pragma-dependency2.c @@ -0,0 +1,5 @@ +// RUN: clang-cc -E %s -verify + +#define DO_PRAGMA _Pragma +DO_PRAGMA ("GCC dependency \"blahblabh\"") // expected-error {{file not found}} + diff --git a/test/Preprocessor/_Pragma-syshdr2.c b/test/Preprocessor/_Pragma-syshdr2.c deleted file mode 100644 index de7f2d3..0000000 --- a/test/Preprocessor/_Pragma-syshdr2.c +++ /dev/null @@ -1,5 +0,0 @@ -// RUN: clang-cc -E %s 2>&1 | grep 'file not found' - -#define DO_PRAGMA _Pragma -DO_PRAGMA ("GCC dependency \"blahblabh\"") - diff --git a/test/Preprocessor/pragma_sysheader.c b/test/Preprocessor/pragma_sysheader.c new file mode 100644 index 0000000..49082b8 --- /dev/null +++ b/test/Preprocessor/pragma_sysheader.c @@ -0,0 +1,3 @@ +// RUN: clang -verify -pedantic %s -fsyntax-only +// rdar://6899937 +#include "pragma_sysheader.h" diff --git a/test/Preprocessor/pragma_sysheader.h b/test/Preprocessor/pragma_sysheader.h new file mode 100644 index 0000000..b79bde5 --- /dev/null +++ b/test/Preprocessor/pragma_sysheader.h @@ -0,0 +1,4 @@ +#pragma GCC system_header +typedef int x; +typedef int x; + diff --git a/test/Preprocessor/print_line_count.c b/test/Preprocessor/print_line_count.c new file mode 100644 index 0000000..2eb62df --- /dev/null +++ b/test/Preprocessor/print_line_count.c @@ -0,0 +1,4 @@ +/* RUN: clang -E -C -P %s | wc -l | grep 4 + PR2741 + comment */ +y diff --git a/test/Sema/block-return.c b/test/Sema/block-return.c index e1a3cfd..87f4040 100644 --- a/test/Sema/block-return.c +++ b/test/Sema/block-return.c @@ -102,3 +102,27 @@ void foo6() { b(1); int (^c)(void) __attribute__((noreturn)) = ^ __attribute__((noreturn)) { return 100; }; // expected-error {{block declared 'noreturn' should not return}} } + + +void foo7() +{ + const int (^BB) (void) = ^{ const int i = 1; return i; }; // OK + const int (^CC) (void) = ^const int{ const int i = 1; return i; }; // OK + + int i; + int (^FF) (void) = ^{ return i; }; // OK + int (^EE) (void) = ^{ return i+1; }; // OK + + __block int j; + int (^JJ) (void) = ^{ return j; }; // OK + int (^KK) (void) = ^{ return j+1; }; // OK + + __block const int k; + const int cint = 100; + + int (^MM) (void) = ^{ return k; }; // expected-error {{incompatible block pointer types initializing 'int const (^)(void)', expected 'int (^)(void)'}} + int (^NN) (void) = ^{ return cint; }; // expected-error {{incompatible block pointer types initializing 'int const (^)(void)', expected 'int (^)(void)'}} + +} + + diff --git a/test/Sema/warn-unused-parameters.c b/test/Sema/warn-unused-parameters.c new file mode 100644 index 0000000..afb9516 --- /dev/null +++ b/test/Sema/warn-unused-parameters.c @@ -0,0 +1,13 @@ +// RUN: clang -fblocks -fsyntax-only -Wunused-parameter %s -Xclang -verify + +int f0(int x, + int y, // expected-warning{{unused}} + int z __attribute__((unused))) { + return x; +} + +void f1() { + (void)^(int x, + int y, // expected-warning{{unused}} + int z __attribute__((unused))) { return x; }; +} diff --git a/test/SemaCXX/default-constructor-initializers.cpp b/test/SemaCXX/default-constructor-initializers.cpp new file mode 100644 index 0000000..c5250f8 --- /dev/null +++ b/test/SemaCXX/default-constructor-initializers.cpp @@ -0,0 +1,56 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +struct X1 { // has no implicit default constructor + X1(int); +}; + +struct X2 : X1 { // expected-note {{'struct X2' declared here}} \ + // expected-note {{'struct X2' declared here}} + X2(int); +}; + +struct X3 : public X2 { +}; +X3 x3; // expected-error {{cannot define the default constructor for 'struct X3', because member 'struct X2' does not have any implicit default constructor}} + + +struct X4 { + X2 x2; + X2 & rx2; // expected-note {{declared at}} +}; + +X4 x4; // expected-error {{cannot define the default constructor for 'struct X4', because base class 'struct X2' does not have any implicit default constructor}} \ + // expected-error {{cannot define the implicit default constructor for 'struct X4', because reference member rx2 cannot be default-initialized}} + + +struct Y1 { // has no implicit default constructor + Y1(int); +}; + +struct Y2 : Y1 { + Y2(int); + Y2(); +}; + +struct Y3 : public Y2 { +}; +Y3 y3; + +struct Y4 { + Y2 y2; +}; + +Y4 y4; + +// More tests + + +struct Z1 { + int& z; // expected-note {{declared at}} + const int c1; // expected-note {{declared at}} + volatile int v1; +}; + +Z1 z1; // expected-error {{cannot define the implicit default constructor for 'struct Z1', because reference member z cannot be default-initialized}} \ + // expected-error {{cannot define the implicit default constructor for 'struct Z1', because const member c1 cannot be default-initialized}} + diff --git a/test/SemaCXX/using-directive.cpp b/test/SemaCXX/using-directive.cpp index 924cf07..78ad0429 100644 --- a/test/SemaCXX/using-directive.cpp +++ b/test/SemaCXX/using-directive.cpp @@ -64,7 +64,7 @@ struct K2 k2; // expected-error{{reference to 'K2' is ambiguous}} \ class X { // expected-note{{candidate found by name lookup is 'X'}} // FIXME: produce a suitable error message for this - using namespace A; // expected-error{{expected member name or}} + using namespace A; // expected-error{{not allowed}} }; namespace N { diff --git a/test/SemaObjC/undeclared-selector.m b/test/SemaObjC/undeclared-selector.m new file mode 100644 index 0000000..354c316 --- /dev/null +++ b/test/SemaObjC/undeclared-selector.m @@ -0,0 +1,45 @@ +// RUN: clang-cc -fsyntax-only -Wundeclared-selector -verify %s + +typedef struct objc_selector *SEL; + +@interface MyClass + ++ (void) methodA; +- (void) methodB; ++ (void) methodD; +- (void) methodF; + +@end + +@implementation MyClass + ++ (void) methodA {} +- (void) methodB {} ++ (void) methodD +{ + SEL d = @selector(methodD); /* Ok */ + SEL e = @selector(methodE); // expected-warning {{undeclared selector 'methodE'}} +} + +- (void) methodE +{ + SEL e = @selector(methodE); /* Ok */ +} + +- (void) methodF +{ + SEL e = @selector(methodE); /* Ok */ +} + +@end + +int main (void) +{ + SEL a = @selector(methodA); /* Ok */ + SEL b = @selector(methodB); /* Ok */ + SEL c = @selector(methodC); // expected-warning {{undeclared selector 'methodC'}} + SEL d = @selector(methodD); /* Ok */ + SEL e = @selector(methodE); /* Ok */ + return 0; + +} diff --git a/test/SemaObjC/warn-unused-parameters.m b/test/SemaObjC/warn-unused-parameters.m new file mode 100644 index 0000000..618dc3f --- /dev/null +++ b/test/SemaObjC/warn-unused-parameters.m @@ -0,0 +1,11 @@ +// RUN: clang -fsyntax-only -Wunused -Xclang -verify %s + +@interface foo +- (int)meth: (int)x: (int)y: (int)z ; +@end + +@implementation foo +- (int) meth: (int)x: + (int)y: // expected-warning{{unused}} + (int) __attribute__((unused))z { return x; } +@end diff --git a/test/SemaTemplate/ext-vector-type.cpp b/test/SemaTemplate/ext-vector-type.cpp new file mode 100644 index 0000000..d6c02bb --- /dev/null +++ b/test/SemaTemplate/ext-vector-type.cpp @@ -0,0 +1,47 @@ +// RUN: clang-cc -fsyntax-only -verify %s +template<typename T, unsigned Length> +struct make1 { + typedef T __attribute__((ext_vector_type(Length))) type; +}; + +int test_make1() { + make1<int, 5>::type x; + x.x = 4; +} + +template<typename T, unsigned Length> +struct make2 { + typedef T __attribute__((ext_vector_type(Length))) type; // expected-error{{zero vector size}} +}; + +int test_make2() { + make2<int, 0> x; // expected-note{{in instantiation of}} +} + +template<typename T, unsigned Length> +struct make3 { + typedef T __attribute__((ext_vector_type(Length))) type; // expected-error{{invalid vector type 'struct s'}} +}; + +struct s {}; + +int test_make3() { + make3<s, 3>x; // expected-note{{in instantiation of}} +} + +template<typename T, T Length> +struct make4 { + typedef T __attribute__((ext_vector_type(Length))) type; +}; + +int test_make4() { + make4<int, 4>::type x; + x.w = 7; +} + +typedef int* int_ptr; +template<unsigned Length> +struct make5 { + typedef int_ptr __attribute__((ext_vector_type(Length))) type; // expected-error{{invalid vector type}} +}; + diff --git a/test/SemaTemplate/nested-template.cpp b/test/SemaTemplate/nested-template.cpp index bd9e89f..84b1d35 100644 --- a/test/SemaTemplate/nested-template.cpp +++ b/test/SemaTemplate/nested-template.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only %s +// RUN: clang-cc -fsyntax-only -verify %s class A; |