Page MenuHomePhabricator

No OneTemporary

File Metadata

Created
Fri, Jan 24, 4:17 PM
This file is larger than 256 KB, so syntax highlighting was skipped.
Index: cfe/trunk/test/SemaTemplate/dependent-type-identity.cpp
===================================================================
--- cfe/trunk/test/SemaTemplate/dependent-type-identity.cpp (revision 234676)
+++ cfe/trunk/test/SemaTemplate/dependent-type-identity.cpp (revision 234677)
@@ -1,145 +1,147 @@
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
// This test concerns the identity of dependent types within the
// canonical type system. This corresponds to C++ [temp.type], which
// specifies type equivalence within a template.
//
// FIXME: template template parameters
namespace N {
template<typename T>
struct X2 {
template<typename U>
struct apply {
typedef U* type;
};
};
}
namespace Nalias = N;
template<typename T>
struct X0 { };
using namespace N;
template<typename T, typename U>
struct X1 {
typedef T type;
typedef U U_type;
void f0(T); // expected-note{{previous}}
void f0(U);
void f0(type); // expected-error{{redeclar}}
void f1(T*); // expected-note{{previous}}
void f1(U*);
void f1(type*); // expected-error{{redeclar}}
void f2(X0<T>*); // expected-note{{previous}}
void f2(X0<U>*);
void f2(X0<type>*); // expected-error{{redeclar}}
void f3(X0<T>*); // expected-note{{previous}}
void f3(X0<U>*);
void f3(::X0<type>*); // expected-error{{redeclar}}
void f4(typename T::template apply<U>*); // expected-note{{previous}}
void f4(typename U::template apply<U>*);
void f4(typename type::template apply<T>*);
void f4(typename type::template apply<U_type>*); // expected-error{{redeclar}}
void f5(typename T::template apply<U>::type*); // expected-note{{previous}}
void f5(typename U::template apply<U>::type*);
void f5(typename U::template apply<T>::type*);
void f5(typename type::template apply<T>::type*);
void f5(typename type::template apply<U_type>::type*); // expected-error{{redeclar}}
void f6(typename N::X2<T>::template apply<U> *); // expected-note{{previous}}
void f6(typename N::X2<U>::template apply<U> *);
void f6(typename N::X2<U>::template apply<T> *);
void f6(typename ::N::X2<type>::template apply<U_type> *); // expected-error{{redeclar}}
void f7(typename N::X2<T>::template apply<U> *); // expected-note{{previous}}
void f7(typename N::X2<U>::template apply<U> *);
void f7(typename N::X2<U>::template apply<T> *);
void f7(typename X2<type>::template apply<U_type> *); // expected-error{{redeclar}}
void f8(typename N::X2<T>::template apply<U> *); // expected-note{{previous}}
void f8(typename N::X2<U>::template apply<U> *);
void f8(typename N::X2<U>::template apply<T> *);
void f8(typename ::Nalias::X2<type>::template apply<U_type> *); // expected-error{{redeclar}}
};
namespace PR6851 {
template <bool v>
struct S;
struct N {
template <bool w>
S< S<w>::cond && 1 > foo();
};
struct Alien;
bool operator&&(const Alien&, const Alien&);
template <bool w>
S< S<w>::cond && 1 > N::foo() { }
}
namespace PR7460 {
template <typename T>
struct TemplateClass2
{
enum { SIZE = 100 };
static T member[SIZE];
};
template <typename T>
T TemplateClass2<T>::member[TemplateClass2<T>::SIZE];
}
namespace PR18275 {
template<typename T> struct A {
void f(const int);
void g(int);
void h(const T);
void i(T);
};
template<typename T>
void A<T>::f(int x) { x = 0; }
template<typename T>
- void A<T>::g(const int x) { x = 0; } // expected-error {{not assignable}}
+ void A<T>::g(const int x) { // expected-note {{declared const here}}
+ x = 0; // expected-error {{cannot assign to variable 'x'}}
+ }
template<typename T>
void A<T>::h(T) {} // FIXME: Should reject this. Type is different from prior decl if T is an array type.
template<typename T>
void A<T>::i(const T) {} // FIXME: Should reject this. Type is different from prior decl if T is an array type.
template struct A<int>;
template struct A<int[1]>;
}
namespace PR21289 {
template<typename T> using X = int;
template<typename T, decltype(sizeof(0))> using Y = int;
template<typename ...Ts> struct S {};
template<typename ...Ts> void f() {
// This is a dependent type. It is *not* S<int>, even though it canonically
// contains no template parameters.
using Type = S<X<Ts>...>;
Type s;
using Type = S<int, int, int>;
}
void g() { f<void, void, void>(); }
template<typename ...Ts> void h(S<int>) {}
// Pending a core issue, it's not clear if these are redeclarations, but they
// are probably intended to be... even though substitution can succeed for one
// of them but fail for the other!
template<typename ...Ts> void h(S<X<Ts>...>) {} // expected-note {{previous}}
template<typename ...Ts> void h(S<Y<Ts, sizeof(Ts)>...>) {} // expected-error {{redefinition}}
}
Index: cfe/trunk/test/SemaObjC/arc.m
===================================================================
--- cfe/trunk/test/SemaObjC/arc.m (revision 234676)
+++ cfe/trunk/test/SemaObjC/arc.m (revision 234677)
@@ -1,800 +1,800 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -fblocks -verify -Wno-objc-root-class %s
typedef unsigned long NSUInteger;
typedef const void * CFTypeRef;
CFTypeRef CFBridgingRetain(id X);
id CFBridgingRelease(CFTypeRef);
@protocol NSCopying @end
@interface NSDictionary
+ (id)dictionaryWithObjects:(const id [])objects forKeys:(const id <NSCopying> [])keys count:(NSUInteger)cnt;
- (void)setObject:(id)object forKeyedSubscript:(id)key;
@end
@class NSFastEnumerationState;
@protocol NSFastEnumeration
- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id __unsafe_unretained [])buffer count:(NSUInteger)len;
@end
@interface NSNumber
+ (NSNumber *)numberWithInt:(int)value;
@end
@interface NSArray <NSFastEnumeration>
+ (id)arrayWithObjects:(const id [])objects count:(NSUInteger)cnt;
@end
void test0(void (*fn)(int), int val) {
fn(val);
}
@interface A
- (id)retain;
- (id)autorelease;
- (oneway void)release;
- (void)dealloc;
- (NSUInteger)retainCount;
@end
void test1(A *a) {
SEL s = @selector(retain); // expected-error {{ARC forbids use of 'retain' in a @selector}}
s = @selector(release); // expected-error {{ARC forbids use of 'release' in a @selector}}
s = @selector(autorelease); // expected-error {{ARC forbids use of 'autorelease' in a @selector}}
s = @selector(dealloc); // expected-error {{ARC forbids use of 'dealloc' in a @selector}}
[a dealloc]; // expected-error {{ARC forbids explicit message send of 'dealloc'}}
[a retain]; // expected-error {{ARC forbids explicit message send of 'retain'}}
[a retainCount]; // expected-error {{ARC forbids explicit message send of 'retainCount'}}
[a release]; // expected-error {{ARC forbids explicit message send of 'release'}}
[a autorelease]; // expected-error {{ARC forbids explicit message send of 'autorelease'}}
}
@interface Test2 : A
- (void) dealloc;
@end
@implementation Test2
- (void) dealloc {
// This should maybe just be ignored. We're just going to warn about it for now.
[super dealloc]; // expected-error {{ARC forbids explicit message send of 'dealloc'}}
}
@end
// rdar://8843638
@interface I
- (id)retain; // expected-note {{method 'retain' declared here}}
- (id)autorelease; // expected-note {{method 'autorelease' declared here}}
- (oneway void)release; // expected-note {{method 'release' declared here}}
- (NSUInteger)retainCount; // expected-note {{method 'retainCount' declared here}}
@end
@implementation I
- (id)retain{return 0;} // expected-error {{ARC forbids implementation of 'retain'}}
- (id)autorelease{return 0;} // expected-error {{ARC forbids implementation of 'autorelease'}}
- (oneway void)release{} // expected-error {{ARC forbids implementation of 'release'}}
- (NSUInteger)retainCount{ return 0; } // expected-error {{ARC forbids implementation of 'retainCount'}}
@end
@implementation I(CAT)
- (id)retain{return 0;} // expected-error {{ARC forbids implementation of 'retain'}} \
// expected-warning {{category is implementing a method which will also be implemented by its primary class}}
- (id)autorelease{return 0;} // expected-error {{ARC forbids implementation of 'autorelease'}} \
// expected-warning {{category is implementing a method which will also be implemented by its primary class}}
- (oneway void)release{} // expected-error {{ARC forbids implementation of 'release'}} \
// expected-warning {{category is implementing a method which will also be implemented by its primary class}}
- (NSUInteger)retainCount{ return 0; } // expected-error {{ARC forbids implementation of 'retainCount'}} \
// expected-warning {{category is implementing a method which will also be implemented by its primary class}}
@end
// rdar://8861761
@interface B
+ (id)alloc;
- (id)initWithInt: (int) i;
- (id)myInit __attribute__((objc_method_family(init)));
- (id)myBadInit __attribute__((objc_method_family(12))); // expected-error {{'objc_method_family' attribute requires parameter 1 to be an identifier}}
@end
void rdar8861761() {
B *o1 = [[B alloc] initWithInt:0];
B *o2 = [B alloc];
[o2 initWithInt:0]; // expected-warning {{expression result unused}}
B *o3 = [[B alloc] myInit];
[[B alloc] myInit]; // expected-warning {{expression result unused}}
}
// rdar://8925835
@interface rdar8925835
- (void)foo:(void (^)(unsigned captureCount, I * const capturedStrings[captureCount]))block;
@end
void test5() {
extern void test5_helper(__autoreleasing id *);
id x;
// Okay because of magic temporaries.
test5_helper(&x);
__autoreleasing id *a = &x; // expected-error {{initializing '__autoreleasing id *' with an expression of type '__strong id *' changes retain/release properties of pointer}}
a = &x; // expected-error {{assigning '__strong id *' to '__autoreleasing id *' changes retain/release properties of pointer}}
extern void test5_helper2(id const *);
test5_helper2(&x);
extern void test5_helper3(__weak id *); // expected-note {{passing argument to parameter here}}
test5_helper3(&x); // expected-error {{passing '__strong id *' to parameter of type '__weak id *' changes retain/release properties of pointer}}
}
// rdar://problem/8937869
void test6(unsigned cond) {
switch (cond) {
case 0:
;
id x; // expected-note {{jump bypasses initialization of retaining variable}}
case 1: // expected-error {{cannot jump}}
break;
}
}
@class NSError;
void test7(void) {
extern void test7_helper(NSError **);
NSError *err;
test7_helper(&err);
}
void test7_weak(void) {
extern void test7_helper(NSError **);
__weak NSError *err;
test7_helper(&err);
}
void test7_unsafe(void) {
extern void test7_helper(NSError **); // expected-note {{passing argument to parameter here}}
__unsafe_unretained NSError *err;
test7_helper(&err); // expected-error {{passing 'NSError *__unsafe_unretained *' to parameter of type 'NSError *__autoreleasing *' changes retain/release properties of pointer}}
}
@class Test8_incomplete;
@interface Test8_complete @end;
@interface Test8_super @end;
@interface Test8 : Test8_super
- (id) init00;
- (id) init01; // expected-note {{declaration in interface}} \
// expected-note{{overridden method}}
- (id) init02; // expected-note{{overridden method}}
- (id) init03; // covariance
- (id) init04; // covariance
- (id) init05; // expected-note{{overridden method}}
- (void) init10; // expected-note {{declaration in interface is not in the 'init' family because its result type is not an object pointer}}
- (void) init11;
- (void) init12;
- (void) init13; // expected-note {{declaration in interface is not in the 'init' family because its result type is not an object pointer}}
- (void) init14; // expected-note {{declaration in interface is not in the 'init' family because its result type is not an object pointer}}
- (void) init15;
// These should be invalid to actually call.
- (Test8_incomplete*) init20;
- (Test8_incomplete*) init21; // expected-note {{declaration in interface}}
- (Test8_incomplete*) init22;
- (Test8_incomplete*) init23;
- (Test8_incomplete*) init24;
- (Test8_incomplete*) init25;
- (Test8_super*) init30; // id exception to covariance
- (Test8_super*) init31; // expected-note {{declaration in interface}} \
// expected-note{{overridden method}}
- (Test8_super*) init32; // expected-note{{overridden method}}
- (Test8_super*) init33;
- (Test8_super*) init34; // covariance
- (Test8_super*) init35; // expected-note{{overridden method}}
- (Test8*) init40; // id exception to covariance
- (Test8*) init41; // expected-note {{declaration in interface}} \
// expected-note{{overridden method}}
- (Test8*) init42; // expected-note{{overridden method}}
- (Test8*) init43; // this should be a warning, but that's a general language thing, not an ARC thing
- (Test8*) init44;
- (Test8*) init45; // expected-note{{overridden method}}
- (Test8_complete*) init50; // expected-error {{init methods must return a type related to the receiver type}}
- (Test8_complete*) init51; // expected-error {{init methods must return a type related to the receiver type}}
- (Test8_complete*) init52; // expected-error {{init methods must return a type related to the receiver type}}
- (Test8_complete*) init53; // expected-error {{init methods must return a type related to the receiver type}}
- (Test8_complete*) init54; // expected-error {{init methods must return a type related to the receiver type}}
- (Test8_complete*) init55; // expected-error {{init methods must return a type related to the receiver type}}
@end
@implementation Test8
- (id) init00 { return 0; }
- (id) init10 { return 0; } // expected-error {{method implementation does not match its declaration}}
- (id) init20 { return 0; }
- (id) init30 { return 0; }
- (id) init40 { return 0; }
- (id) init50 { return 0; }
- (void) init01 {} // expected-error {{method was declared as an 'init' method, but its implementation doesn't match because its result type is not an object pointer}} \
// expected-warning{{method is expected to return an instance of its class type 'Test8', but is declared to return 'void'}}
- (void) init11 {}
- (void) init21 {} // expected-error {{method was declared as an 'init' method, but its implementation doesn't match because its result type is not an object pointer}}
- (void) init31 {} // expected-error {{method was declared as an 'init' method, but its implementation doesn't match because its result type is not an object pointer}} \
// expected-warning{{method is expected to return an instance of its class type 'Test8', but is declared to return 'void'}}
- (void) init41 {} // expected-error {{method was declared as an 'init' method, but its implementation doesn't match because its result type is not an object pointer}} \
// expected-warning{{method is expected to return an instance of its class type 'Test8', but is declared to return 'void'}}
- (void) init51 {}
- (Test8_incomplete*) init02 { return 0; } // expected-error {{init methods must return a type related to the receiver type}} \
// expected-warning{{method is expected to return an instance of its class type 'Test8', but is declared to return 'Test8_incomplete *'}}
- (Test8_incomplete*) init12 { return 0; } // expected-error {{init methods must return a type related to the receiver type}}
- (Test8_incomplete*) init22 { return 0; } // expected-error {{init methods must return a type related to the receiver type}}
- (Test8_incomplete*) init32 { return 0; } // expected-error {{init methods must return a type related to the receiver type}} \
// expected-warning{{method is expected to return an instance of its class type 'Test8', but is declared to return 'Test8_incomplete *'}}
- (Test8_incomplete*) init42 { return 0; } // expected-error {{init methods must return a type related to the receiver type}} \
// expected-warning{{method is expected to return an instance of its class type 'Test8', but is declared to return 'Test8_incomplete *'}}
- (Test8_incomplete*) init52 { return 0; } // expected-error {{init methods must return a type related to the receiver type}}
- (Test8_super*) init03 { return 0; }
- (Test8_super*) init13 { return 0; } // expected-error {{method implementation does not match its declaration}}
- (Test8_super*) init23 { return 0; }
- (Test8_super*) init33 { return 0; }
- (Test8_super*) init43 { return 0; }
- (Test8_super*) init53 { return 0; }
- (Test8*) init04 { return 0; }
- (Test8*) init14 { return 0; } // expected-error {{method implementation does not match its declaration}}
- (Test8*) init24 { return 0; }
- (Test8*) init34 { return 0; }
- (Test8*) init44 { return 0; }
- (Test8*) init54 { return 0; }
- (Test8_complete*) init05 { return 0; } // expected-error {{init methods must return a type related to the receiver type}} \
// expected-warning{{method is expected to return an instance of its class type 'Test8', but is declared to return 'Test8_complete *'}}
- (Test8_complete*) init15 { return 0; } // expected-error {{init methods must return a type related to the receiver type}}
- (Test8_complete*) init25 { return 0; } // expected-error {{init methods must return a type related to the receiver type}}
- (Test8_complete*) init35 { return 0; } // expected-error {{init methods must return a type related to the receiver type}} \
// expected-warning{{method is expected to return an instance of its class type 'Test8', but is declared to return 'Test8_complete *'}}
- (Test8_complete*) init45 { return 0; } // expected-error {{init methods must return a type related to the receiver type}} \
// expected-warning{{method is expected to return an instance of its class type 'Test8', but is declared to return 'Test8_complete *'}}
- (Test8_complete*) init55 { return 0; } // expected-error {{init methods must return a type related to the receiver type}}
@end
@class Test9_incomplete;
@interface Test9
- (Test9_incomplete*) init1; // expected-error {{init methods must return a type related to the receiver type}}
- (Test9_incomplete*) init2;
@end
id test9(Test9 *v) {
return [v init1];
}
// Test that the inference rules are different for fast enumeration variables.
void test10(id collection) {
for (id x in collection) {
__strong id *ptr = &x; // expected-warning {{initializing '__strong id *' with an expression of type 'const __strong id *' discards qualifiers}}
}
for (__strong id x in collection) {
__weak id *ptr = &x; // expected-error {{initializing '__weak id *' with an expression of type '__strong id *' changes retain/release properties of pointer}}
}
}
// rdar://problem/9078626
#define nil ((void*) 0)
void test11(id op, void *vp) {
_Bool b;
b = (op == nil);
b = (nil == op);
b = (vp == nil);
b = (nil == vp);
b = (vp == op); // expected-error {{implicit conversion of Objective-C pointer type 'id' to C pointer type 'void *' requires a bridged cast}} expected-note {{use __bridge}} expected-note {{use CFBridgingRetain call}}
b = (op == vp);
}
void test12(id collection) {
for (id x in collection) {
x = 0; // expected-error {{fast enumeration variables can't be modified in ARC by default; declare the variable __strong to allow this}}
}
- for (const id x in collection) {
- x = 0; // expected-error {{read-only variable is not assignable}}
+ for (const id x in collection) { // expected-note {{variable 'x' declared const here}}
+ x = 0; // expected-error {{cannot assign to variable 'x' with const-qualified type 'const __strong id'}}
}
for (__strong id x in collection) {
x = 0;
}
}
@interface Test13
- (id) init0;
- (void) noninit;
@end
@implementation Test13
- (id) init0 {
self = 0;
}
- (void) noninit {
self = 0; // expected-error {{cannot assign to 'self' outside of a method in the init family}}
}
@end
// <rdar://problem/10274056>
@interface Test13_B
- (id) consumesSelf __attribute__((ns_consumes_self));
@end
@implementation Test13_B
- (id) consumesSelf {
self = 0; // no-warning
}
@end
// rdar://problem/9172151
@class Test14A, Test14B;
void test14() {
extern void test14_consume(id *);
extern int test14_cond(void);
extern float test14_nowriteback(id __autoreleasing const *); // expected-note{{passing argument to parameter here}}
Test14A *a;
Test14B *b;
id i;
id cla[10];
id vla[test14_cond() + 10];
test14_consume((__strong id*) &a);
test14_consume((test14_cond() ? (__strong id*) &b : &i));
test14_consume(test14_cond() ? 0 : &a);
test14_consume(test14_cond() ? (void*) 0 : (&a));
test14_consume(cla); // expected-error {{passing address of non-scalar object to __autoreleasing parameter for write-back}}
test14_consume(vla); // expected-error {{passing address of non-scalar object to __autoreleasing parameter for write-back}}
test14_consume(&cla[5]); // expected-error {{passing address of non-scalar object to __autoreleasing parameter for write-back}}
__strong id *test14_indirect(void);
test14_consume(test14_indirect()); // expected-error {{passing address of non-local object to __autoreleasing parameter for write-back}}
extern id test14_global;
test14_consume(&test14_global); // expected-error {{passing address of non-local object to __autoreleasing parameter for write-back}}
extern __strong id *test14_global_ptr;
test14_consume(test14_global_ptr); // expected-error {{passing address of non-local object to __autoreleasing parameter for write-back}}
static id static_local;
test14_consume(&static_local); // expected-error {{passing address of non-local object to __autoreleasing parameter for write-back}}
__weak id* wip;
test14_nowriteback(&static_local); // okay, not a write-back.
test14_nowriteback(wip); // expected-error{{passing '__weak id *' to parameter of type '__autoreleasing id const *' changes retain/release properties of pointer}}
}
void test15() {
__block __autoreleasing id x; // expected-error {{__block variables cannot have __autoreleasing ownership}}
}
struct Test16;
@interface Test16a
- (void) test16_0: (int) x;
- (int) test16_1: (int) x; // expected-note {{one possibility}}
- (int) test16_2: (int) x; // expected-note {{one possibility}}
- (id) test16_3: (int) x __attribute__((ns_returns_retained)); // expected-note {{one possibility}}
- (void) test16_4: (int) x __attribute__((ns_consumes_self)); // expected-note {{one possibility}}
- (void) test16_5: (id) __attribute__((ns_consumed)) x; // expected-note {{one possibility}}
- (void) test16_6: (id) x;
@end
@interface Test16b
- (void) test16_0: (int) x;
- (int) test16_1: (char*) x; // expected-note {{also found}}
- (char*) test16_2: (int) x; // expected-note {{also found}}
- (id) test16_3: (int) x; // expected-note {{also found}}
- (void) test16_4: (int) x; // expected-note {{also found}}
- (void) test16_5: (id) x; // expected-note {{also found}}
- (void) test16_6: (struct Test16 *) x;
@end
void test16(void) {
id v;
[v test16_0: 0];
[v test16_1: 0]; // expected-error {{multiple methods named 'test16_1:' found with mismatched result, parameter type or attributes}}
[v test16_2: 0]; // expected-error {{multiple methods named}}
[v test16_3: 0]; // expected-error {{multiple methods named}}
[v test16_4: 0]; // expected-error {{multiple methods named}}
[v test16_5: 0]; // expected-error {{multiple methods named}}
[v test16_6: 0];
}
@class Test17; // expected-note 2{{forward declaration of class here}}
@protocol Test17p
- (void) test17;
+ (void) test17;
@end
void test17(void) {
Test17 *v0;
[v0 test17]; // expected-error {{receiver type 'Test17' for instance message is a forward declaration}}
Test17<Test17p> *v1;
[v1 test17]; // expected-error {{receiver type 'Test17<Test17p>' for instance message is a forward declaration}}
[Test17 test17]; // expected-error {{receiver 'Test17' for class message is a forward declaration}}
}
void test18(void) {
id x;
[x test18]; // expected-error {{instance method 'test18' not found ; did you mean 'test17'?}}
}
extern struct Test19 *test19a;
struct Test19 *const test19b = 0;
void test19(void) {
id x;
x = (id) test19a; // expected-error {{bridged cast}} \
// expected-note{{use __bridge to convert directly (no change in ownership)}} \
// expected-note{{use CFBridgingRelease call to transfer ownership of a +1 'struct Test19 *' into ARC}}
x = (id) test19b; // expected-error {{bridged cast}} \
// expected-note{{use __bridge to convert directly (no change in ownership)}} \
// expected-note{{use CFBridgingRelease call to transfer ownership of a +1 'struct Test19 *' into ARC}}
}
// rdar://problem/8951453
static __thread id test20_implicit; // expected-error {{thread-local variable has non-trivial ownership: type is '__strong id'}}
static __thread __strong id test20_strong; // expected-error {{thread-local variable has non-trivial ownership: type is '__strong id'}}
static __thread __weak id test20_weak; // expected-error {{thread-local variable has non-trivial ownership: type is '__weak id'}}
static __thread __autoreleasing id test20_autoreleasing; // expected-error {{thread-local variable has non-trivial ownership: type is '__autoreleasing id'}} expected-error {{global variables cannot have __autoreleasing ownership}}
static __thread __unsafe_unretained id test20_unsafe;
void test20(void) {
static __thread id test20_implicit; // expected-error {{thread-local variable has non-trivial ownership: type is '__strong id'}}
static __thread __strong id test20_strong; // expected-error {{thread-local variable has non-trivial ownership: type is '__strong id'}}
static __thread __weak id test20_weak; // expected-error {{thread-local variable has non-trivial ownership: type is '__weak id'}}
static __thread __autoreleasing id test20_autoreleasing; // expected-error {{thread-local variable has non-trivial ownership: type is '__autoreleasing id'}} expected-error {{global variables cannot have __autoreleasing ownership}}
static __thread __unsafe_unretained id test20_unsafe;
}
// rdar://9310049
_Bool fn(id obj) {
return (_Bool)obj;
}
// Check casting w/ ownership qualifiers.
void test21() {
__strong id *sip;
(void)(__weak id *)sip; // expected-error{{casting '__strong id *' to type '__weak id *' changes retain/release properties of pointer}}
(void)(__weak const id *)sip; // expected-error{{casting '__strong id *' to type '__weak id const *' changes retain/release properties of pointer}}
(void)(__autoreleasing id *)sip; // expected-error{{casting '__strong id *' to type '__autoreleasing id *' changes retain/release properties of pointer}}
(void)(__autoreleasing const id *)sip; // okay
}
// rdar://problem/9340462
void test22(id x[]) { // expected-error {{must explicitly describe intended ownership of an object array parameter}}
}
// rdar://problem/9400219
void test23(void) {
void *ptr;
ptr = @"foo";
ptr = (ptr ? @"foo" : 0);
ptr = (ptr ? @"foo" : @"bar");
}
id test24(void) {
extern void test24_helper(void);
return test24_helper(), (void*) 0;
}
// rdar://9400841
@interface Base
@property (assign) id content;
@end
@interface Foo : Base
-(void)test;
@end
@implementation Foo
-(void)test {
super.content = 0;
}
@end
// <rdar://problem/9398437>
void test25(Class *classes) {
Class *other_classes;
test25(other_classes);
}
void test26(id y) {
extern id test26_var1;
__sync_swap(&test26_var1, 0, y); // expected-error {{cannot perform atomic operation on a pointer to type '__strong id': type has non-trivial ownership}}
extern __unsafe_unretained id test26_var2;
__sync_swap(&test26_var2, 0, y);
}
@interface Test26
- (id) init;
- (id) initWithInt: (int) x;
@end
@implementation Test26
- (id) init { return self; }
- (id) initWithInt: (int) x {
[self init]; // expected-error {{the result of a delegate init call must be immediately returned or assigned to 'self'}}
return self;
}
@end
// rdar://9525555
@interface Test27 {
__weak id _myProp1;
id myProp2;
}
@property id x;
@property (readonly) id ro;
@property (readonly) id custom_ro;
@property int y;
@property (readonly) __weak id myProp1;
@property (readonly) id myProp2;
@property (readonly) __strong id myProp3;
@end
@implementation Test27
@synthesize x;
@synthesize ro;
@synthesize y;
@synthesize myProp1 = _myProp1;
@synthesize myProp2;
@synthesize myProp3;
-(id)custom_ro { return 0; }
@end
// rdar://9569264
@interface Test28
@property (nonatomic, assign) __strong id a; // expected-error {{unsafe_unretained property 'a' may not also be declared __strong}}
@end
@interface Test28 ()
@property (nonatomic, assign) __strong id b; // expected-error {{unsafe_unretained property 'b' may not also be declared __strong}}
@end
@implementation Test28
@synthesize a;
@synthesize b;
@end
// rdar://9573962
typedef struct Bark Bark;
@interface Test29
@property Bark* P;
@end
@implementation Test29
@synthesize P;
- (id)Meth {
Bark** f = &P;
return 0;
}
@end
// rdar://9495837
@interface Test30
+ (id) new;
- (void)Meth;
@end
@implementation Test30
+ (id) new { return 0; }
- (void) Meth {
__weak id x = [Test30 new]; // expected-warning {{assigning retained object to weak variable}}
id __unsafe_unretained u = [Test30 new]; // expected-warning {{assigning retained object to unsafe_unretained variable}}
id y = [Test30 new];
x = [Test30 new]; // expected-warning {{assigning retained object to weak variable}}
u = [Test30 new]; // expected-warning {{assigning retained object to unsafe_unretained variable}}
y = [Test30 new];
}
@end
// rdar://9411838
@protocol PTest31 @end
int Test31() {
Class cls;
id ids;
id<PTest31> pids;
Class<PTest31> pcls;
int i = (ids->isa ? 1 : 0); // expected-error {{member reference base type 'id' is not a structure or union}}
int j = (pids->isa ? 1 : 0); // expected-error {{member reference base type 'id<PTest31>' is not a structure or union}}
int k = (pcls->isa ? i : j); // expected-error {{member reference base type 'Class<PTest31>' is not a structure or union}}
return cls->isa ? i : j; // expected-error {{member reference base type 'Class' is not a structure or union}}
}
// rdar://9612030
@interface ITest32 {
@public
id ivar;
}
@end
id Test32(__weak ITest32 *x) {
__weak ITest32 *y;
x->ivar = 0; // expected-error {{dereferencing a __weak pointer is not allowed}}
return y ? y->ivar // expected-error {{dereferencing a __weak pointer is not allowed}}
: (*x).ivar; // expected-error {{dereferencing a __weak pointer is not allowed}}
}
// rdar://9619861
extern int printf(const char*, ...);
typedef long intptr_t;
int Test33(id someid) {
printf( "Hello%ld", (intptr_t)someid);
return (int)someid;
}
// rdar://9636091
@interface I34
@property (nonatomic, retain) id newName __attribute__((ns_returns_not_retained)) ;
@property (nonatomic, retain) id newName1 __attribute__((ns_returns_not_retained)) ;
- (id) newName1 __attribute__((ns_returns_not_retained));
@property (nonatomic, retain) id newName2 __attribute__((ns_returns_not_retained)); // expected-note {{roperty declared here}}
- (id) newName2; // expected-warning {{property declared as returning non-retained objects; getter returning retained objects}}
@end
@implementation I34
@synthesize newName;
@synthesize newName1;
- (id) newName1 { return 0; }
@synthesize newName2;
@end
void test35(void) {
extern void test36_helper(id*);
id x;
__strong id *xp = 0;
test36_helper(&x);
test36_helper(xp); // expected-error {{passing address of non-local object to __autoreleasing parameter for write-back}}
// rdar://problem/9665710
__block id y;
test36_helper(&y);
^{ test36_helper(&y); }();
__strong int non_objc_type; // expected-warning {{'__strong' only applies to Objective-C object or block pointer types}}
}
void test36(int first, ...) {
// <rdar://problem/9758798>
__builtin_va_list arglist;
__builtin_va_start(arglist, first);
id obj = __builtin_va_arg(arglist, id);
__builtin_va_end(arglist);
}
@class Test37; // expected-note{{forward declaration of class here}}
void test37(Test37 *c) {
for (id y in c) { // expected-error {{collection expression type 'Test37' is a forward declaration}}
(void) y;
}
(void)sizeof(id*); // no error.
}
// rdar://problem/9887979
@interface Test38
@property int value;
@end
void test38() {
extern Test38 *test38_helper(void);
switch (test38_helper().value) {
case 0:
case 1:
;
}
}
// rdar://10186536
@class NSColor;
void _NSCalc(NSColor* color, NSColor* bezelColors[]) __attribute__((unavailable("not available in automatic reference counting mode")));
void _NSCalcBeze(NSColor* color, NSColor* bezelColors[]); // expected-error {{must explicitly describe intended ownership of an object array parameter}}
// rdar://9970739
@interface RestaurantTableViewCell
- (void) restaurantLocation;
@end
@interface Radar9970739
- (void) Meth;
@end
@implementation Radar9970739
- (void) Meth {
RestaurantTableViewCell *cell;
[cell restaurantLocatoin]; // expected-error {{no visible @interface for 'RestaurantTableViewCell' declares the selector 'restaurantLocatoin'}}
}
@end
// rdar://11814185
@interface Radar11814185
@property (nonatomic, weak) Radar11814185* picker1;
+ alloc;
- init;
@end
@implementation Radar11814185
@synthesize picker1;
- (void)viewDidLoad
{
picker1 = [[Radar11814185 alloc] init]; // expected-warning {{assigning retained object to weak variable; object will be released after assignment}}
self.picker1 = [[Radar11814185 alloc] init]; // expected-warning {{assigning retained object to weak property; object will be released after assignment}}
}
+ alloc { return 0; }
- init { return 0; }
@end
// <rdar://problem/12569201>. Warn on cases of initializing a weak variable
// with an Objective-C object literal.
void rdar12569201(id key, id value) {
// Declarations.
__weak id x = @"foo"; // no-warning
__weak id y = @{ key : value }; // expected-warning {{assigning dictionary literal to a weak variable; object will be released after assignment}}
__weak id z = @[ value ]; // expected-warning {{assigning array literal to a weak variable; object will be released after assignment}}
__weak id b = ^() {}; // expected-warning {{assigning block literal to a weak variable; object will be released after assignment}}
__weak id n = @42; // expected-warning {{assigning numeric literal to a weak variable; object will be released after assignment}}
__weak id e = @(42); // expected-warning {{assigning numeric literal to a weak variable; object will be released after assignment}}
__weak id m = @(41 + 1); // expected-warning {{assigning boxed expression to a weak variable; object will be released after assignment}}
// Assignments.
y = @{ key : value }; // expected-warning {{assigning dictionary literal to a weak variable; object will be released after assignment}}
z = @[ value ]; // expected-warning {{assigning array literal to a weak variable; object will be released after assignment}}
b = ^() {}; // expected-warning {{assigning block literal to a weak variable; object will be released after assignment}}
n = @42; // expected-warning {{assigning numeric literal to a weak variable; object will be released after assignment}}
e = @(42); // expected-warning {{assigning numeric literal to a weak variable; object will be released after assignment}}
m = @(41 + 1); // expected-warning {{assigning boxed expression to a weak variable; object will be released after assignment}}
}
@interface C
- (void)method:(id[])objects; // expected-error{{must explicitly describe intended ownership of an object array parameter}}
@end
// rdar://13752880
@interface NSMutableArray : NSArray @end
typedef __strong NSMutableArray * PSNS;
void test(NSArray *x) {
NSMutableArray *y = x; // expected-warning {{incompatible pointer types initializing 'NSMutableArray *' with an expression of type 'NSArray *'}}
__strong NSMutableArray *y1 = x; // expected-warning {{incompatible pointer types initializing 'NSMutableArray *' with an expression of type 'NSArray *'}}
PSNS y2 = x; // expected-warning {{incompatible pointer types initializing 'NSMutableArray *' with an expression of type 'NSArray *'}}
}
// rdar://15123684
@class NSString;
void foo(NSArray *array) {
for (NSString *string in array) {
for (string in @[@"blah", @"more blah", string]) { // expected-error {{selector element of type 'NSString *const __strong' cannot be a constant l-value}}
}
}
}
// rdar://16627903
extern void abort();
#define TKAssertEqual(a, b) do{\
__typeof(a) a_res = (a);\
__typeof(b) b_res = (b);\
if ((a_res) != (b_res)) {\
abort();\
}\
}while(0)
int garf() {
id object;
TKAssertEqual(object, nil);
TKAssertEqual(object, (id)nil);
}
Index: cfe/trunk/test/Sema/block-misc.c
===================================================================
--- cfe/trunk/test/Sema/block-misc.c (revision 234676)
+++ cfe/trunk/test/Sema/block-misc.c (revision 234677)
@@ -1,228 +1,228 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s -fblocks
void donotwarn();
int (^IFP) ();
int (^II) (int);
int test1() {
int (^PFR) (int) = 0; // OK
PFR = II; // OK
if (PFR == II) // OK
donotwarn();
if (PFR == IFP) // OK
donotwarn();
if (PFR == (int (^) (int))IFP) // OK
donotwarn();
if (PFR == 0) // OK
donotwarn();
if (PFR) // OK
donotwarn();
if (!PFR) // OK
donotwarn();
return PFR != IFP; // OK
}
int test2(double (^S)()) {
double (^I)(int) = (void*) S;
(void*)I = (void *)S; // expected-error {{assignment to cast is illegal, lvalue casts are not supported}}
void *pv = I;
pv = S;
I(1);
return (void*)I == (void *)S;
}
int^ x; // expected-error {{block pointer to non-function type is invalid}}
int^^ x1; // expected-error {{block pointer to non-function type is invalid}} expected-error {{block pointer to non-function type is invalid}}
void test3() {
char *^ y; // expected-error {{block pointer to non-function type is invalid}}
}
enum {NSBIRLazilyAllocated = 0};
int test4(int argc) { // rdar://6251437
^{
switch (argc) {
case NSBIRLazilyAllocated: // is an integer constant expression.
default:
break;
}
}();
return 0;
}
void bar(void*);
// rdar://6257721 - reference to static/global is byref by default.
static int test5g;
void test5() {
bar(^{ test5g = 1; });
}
// rdar://6405429 - __func__ in a block refers to the containing function name.
const char*test6() {
return ^{
return __func__;
} ();
}
// radr://6732116 - block comparisons
void (^test7a)();
int test7(void (^p)()) {
return test7a == p;
}
void test8() {
somelabel:
^{ goto somelabel; }(); // expected-error {{use of undeclared label 'somelabel'}}
}
void test9() {
goto somelabel; // expected-error {{use of undeclared label 'somelabel'}}
^{ somelabel: ; }();
}
void test10(int i) {
switch (i) {
case 41: ;
^{ case 42: ; }(); // expected-error {{'case' statement not in switch statement}}
}
}
void test11(int i) {
switch (i) {
case 41: ;
^{ break; }(); // expected-error {{'break' statement not in loop or switch statement}}
}
for (; i < 100; ++i)
^{ break; }(); // expected-error {{'break' statement not in loop or switch statement}}
}
void (^test12f)(void);
void test12() {
test12f = ^test12f; // expected-error {{type name requires a specifier or qualifier}} expected-error {{expected expression}}
}
// rdar://6808730
void *test13 = ^{
int X = 32;
void *P = ^{
return X+4; // References outer block's "X", so outer block is constant.
};
};
void test14() {
int X = 32;
static void *P = ^{ // expected-error {{initializer element is not a compile-time constant}}
void *Q = ^{
// References test14's "X": outer block is non-constant.
return X+4;
};
};
}
enum { LESS };
void foo(long (^comp)()) { // expected-note{{passing argument to parameter 'comp' here}}
}
void (^test15f)(void);
void test15() {
foo(^{ return LESS; }); // expected-error {{incompatible block pointer types passing 'int (^)(void)' to parameter of type 'long (^)()'}}
}
__block int test16i; // expected-error {{__block attribute not allowed, only allowed on local variables}}
void test16(__block int i) { // expected-error {{__block attribute not allowed, only allowed on local variables}}
int size = 5;
extern __block double extern_var; // expected-error {{__block attribute not allowed, only allowed on local variables}}
static __block char * pch; // expected-error {{__block attribute not allowed, only allowed on local variables}}
__block int a[size]; // expected-error {{__block attribute not allowed on declaration with a variably modified type}}
__block int (*ap)[size]; // expected-error {{__block attribute not allowed on declaration with a variably modified type}}
}
void f();
void test17() {
void (^bp)(int);
void (*rp)(int);
void (^bp1)();
void *vp = bp;
f(1 ? bp : vp);
f(1 ? vp : bp);
f(1 ? bp : bp1);
(void)(bp > rp); // expected-error {{invalid operands}}
(void)(bp > 0); // expected-error {{invalid operands}}
(void)(bp > bp); // expected-error {{invalid operands}}
(void)(bp > vp); // expected-error {{invalid operands}}
f(1 ? bp : rp); // expected-error {{incompatible operand types ('void (^)(int)' and 'void (*)(int)')}}
(void)(bp == 1); // expected-error {{invalid operands to binary expression}}
(void)(bp == 0);
(void)(1 == bp); // expected-error {{invalid operands to binary expression}}
(void)(0 == bp);
(void)(bp < 1); // expected-error {{invalid operands to binary expression}}
(void)(bp < 0); // expected-error {{invalid operands to binary expression}}
(void)(1 < bp); // expected-error {{invalid operands to binary expression}}
(void)(0 < bp); // expected-error {{invalid operands to binary expression}}
}
void test18() {
- void (^const blockA)(void) = ^{ };
- blockA = ^{ }; // expected-error {{read-only variable is not assignable}}
+ void (^const blockA)(void) = ^{ }; // expected-note {{variable 'blockA' declared const here}}
+ blockA = ^{ }; // expected-error {{cannot assign to variable 'blockA' with const-qualified type 'void (^const)(void)}}
}
// rdar://7072507
int test19() {
goto L0; // expected-error {{cannot jump}}
__block int x; // expected-note {{jump bypasses setup of __block variable}}
L0:
x = 0;
^(){ ++x; }();
return x;
}
// radr://7438948
void test20() {
int n = 7;
int vla[n]; // expected-note {{declared here}}
int (*vm)[n] = 0; // expected-note {{declared here}}
vla[1] = 4341;
^{
(void)vla[1]; // expected-error {{cannot refer to declaration with a variably modified type inside block}}
(void)(vm+1); // expected-error {{cannot refer to declaration with a variably modified type inside block}}
}();
}
// radr://7438948
void test21() {
int a[7]; // expected-note {{declared here}}
__block int b[10]; // expected-note {{declared here}}
a[1] = 1;
^{
(void)a[1]; // expected-error {{cannot refer to declaration with an array type inside block}}
(void)b[1]; // expected-error {{cannot refer to declaration with an array type inside block}}
}();
}
// rdar ://8218839
const char * (^func)(void) = ^{ return __func__; };
const char * (^function)(void) = ^{ return __FUNCTION__; };
const char * (^pretty)(void) = ^{ return __PRETTY_FUNCTION__; };
Index: cfe/trunk/test/Sema/assign.c
===================================================================
--- cfe/trunk/test/Sema/assign.c (revision 234676)
+++ cfe/trunk/test/Sema/assign.c (revision 234677)
@@ -1,15 +1,18 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
void *test1(void) { return 0; }
void test2 (const struct {int a;} *x) {
- x->a = 10; // expected-error {{read-only variable is not assignable}}
+ // expected-note@-1 {{variable 'x' declared const here}}
+
+ x->a = 10;
+ // expected-error-re@-1 {{cannot assign to variable 'x' with const-qualified type 'const struct (anonymous struct at {{.*}}assign.c:5:19) *'}}
}
typedef int arr[10];
void test3() {
const arr b;
const int b2[10];
b[4] = 1; // expected-error {{read-only variable is not assignable}}
b2[4] = 1; // expected-error {{read-only variable is not assignable}}
}
Index: cfe/trunk/test/Sema/anonymous-struct-union.c
===================================================================
--- cfe/trunk/test/Sema/anonymous-struct-union.c (revision 234676)
+++ cfe/trunk/test/Sema/anonymous-struct-union.c (revision 234677)
@@ -1,120 +1,121 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
struct X {
union {
float f3;
double d2;
} named;
union {
int i;
float f;
union {
float f2;
double d;
};
};
struct {
int a;
float b;
};
};
void test_unqual_references(struct X x, const struct X xc) {
+ // expected-note@-1 3{{variable 'xc' declared const here}}
x.i = 0;
x.f = 0.0;
x.f2 = x.f;
x.d = x.f;
x.f3 = 0; // expected-error{{no member named 'f3'}}
x.a = 0;
- xc.d = 0.0; // expected-error{{read-only variable is not assignable}}
- xc.f = 0; // expected-error{{read-only variable is not assignable}}
- xc.a = 0; // expected-error{{read-only variable is not assignable}}
+ xc.d = 0.0; // expected-error{{cannot assign to variable 'xc' with const-qualified type 'const struct X'}}
+ xc.f = 0; // expected-error{{cannot assign to variable 'xc' with const-qualified type 'const struct X'}}
+ xc.a = 0; // expected-error{{cannot assign to variable 'xc' with const-qualified type 'const struct X'}}
}
struct Redecl {
int x; // expected-note{{previous declaration is here}}
struct y { }; // expected-warning{{declaration does not declare anything}}
union {
int x; // expected-error{{member of anonymous union redeclares 'x'}}
float y;
double z; // expected-note{{previous declaration is here}}
double zz; // expected-note{{previous declaration is here}}
};
int z; // expected-error{{duplicate member 'z'}}
void zz(); // expected-error{{duplicate member 'zz'}}
};
union { // expected-warning{{declaration does not declare anything}}
int int_val;
float float_val;
};
static union { // expected-warning{{declaration does not declare anything}}
int int_val2;
float float_val2;
};
void f() {
int_val2 = 0; // expected-error{{use of undeclared identifier}}
float_val2 = 0.0; // expected-error{{use of undeclared identifier}}
}
void g() {
union { // expected-warning{{declaration does not declare anything}}
int i;
float f2;
};
i = 0; // expected-error{{use of undeclared identifier}}
f2 = 0.0; // expected-error{{use of undeclared identifier}}
}
// <rdar://problem/6483159>
struct s0 { union { int f0; }; };
// <rdar://problem/6481130>
typedef struct { }; // expected-warning{{typedef requires a name}}
// PR3675
struct s1 {
int f0; // expected-note{{previous declaration is here}}
union {
int f0; // expected-error{{member of anonymous union redeclares 'f0'}}
};
};
// PR3680
struct {}; // expected-warning{{declaration does not declare anything}}
struct s2 {
union {
int a;
} // expected-warning{{expected ';' at end of declaration list}}
}; // expected-error{{expected member name or ';' after declaration specifiers}}
// Make sure we don't a.k.a. anonymous structs.
typedef struct {
int x;
} a_struct;
int tmp = (a_struct) { .x = 0 }; // expected-error {{initializing 'int' with an expression of incompatible type 'a_struct'}}
// This example comes out of the C11 standard; make sure we don't accidentally reject it.
struct s {
struct { int i; };
int a[];
};
// PR20930
struct s3 {
struct { int A __attribute__((deprecated)); }; // expected-note {{'A' has been explicitly marked deprecated here}}
};
void deprecated_anonymous_struct_member(void) {
struct s3 s;
s.A = 1; // expected-warning {{'A' is deprecated}}
}
Index: cfe/trunk/test/CXX/temp/temp.decls/temp.mem/p5.cpp
===================================================================
--- cfe/trunk/test/CXX/temp/temp.decls/temp.mem/p5.cpp (revision 234676)
+++ cfe/trunk/test/CXX/temp/temp.decls/temp.mem/p5.cpp (revision 234677)
@@ -1,79 +1,79 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
struct A {
template <class T> operator T*();
};
template <class T> A::operator T*() { return 0; }
template <> A::operator char*(){ return 0; } // specialization
template A::operator void*(); // explicit instantiation
int main() {
A a;
int *ip;
ip = a.operator int*();
}
// PR5742
namespace PR5742 {
template <class T> struct A { };
template <class T> struct B { };
struct S {
template <class T> operator T();
} s;
void f() {
s.operator A<A<int> >();
s.operator A<B<int> >();
s.operator A<B<A<int> > >();
}
}
// PR5762
class Foo {
public:
template <typename T> operator T();
template <typename T>
T As() {
return this->operator T();
}
template <typename T>
T As2() {
return operator T();
}
int AsInt() {
return this->operator int();
}
};
template float Foo::As();
template double Foo::As2();
// Partial ordering with conversion function templates.
struct X0 {
template<typename T> operator T*() {
- T x = 1;
- x = 17; // expected-error{{read-only variable is not assignable}}
+ T x = 1; // expected-note{{variable 'x' declared const here}}
+ x = 17; // expected-error{{cannot assign to variable 'x' with const-qualified type 'const int'}}
}
template<typename T> operator T*() const; // expected-note{{explicit instantiation refers here}}
template<typename T> operator const T*() const {
T x = T();
return x; // expected-error{{cannot initialize return object of type 'const char *' with an lvalue of type 'char'}} \
// expected-error{{cannot initialize return object of type 'const int *' with an lvalue of type 'int'}}
}
};
template X0::operator const char*() const; // expected-note{{'X0::operator const char *<char>' requested here}}
template X0::operator const int*(); // expected-note{{'X0::operator const int *<const int>' requested here}}
template X0::operator float*() const; // expected-error{{explicit instantiation of undefined function template}}
void test_X0(X0 x0, const X0 &x0c) {
x0.operator const int*(); // expected-note{{in instantiation of function template specialization}}
x0.operator float *();
x0c.operator const char*();
}
Index: cfe/trunk/test/SemaCXX/err_typecheck_assign_const.cpp
===================================================================
--- cfe/trunk/test/SemaCXX/err_typecheck_assign_const.cpp (revision 0)
+++ cfe/trunk/test/SemaCXX/err_typecheck_assign_const.cpp (revision 234677)
@@ -0,0 +1,124 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
+
+const int global = 5; // expected-note{{variable 'global' declared const here}}
+void test1() {
+ global = 2; // expected-error{{cannot assign to variable 'global' with const-qualified type 'const int'}}
+}
+
+void test2 () {
+ const int local = 5; // expected-note{{variable 'local' declared const here}}
+ local = 0; // expected-error{{cannot assign to variable 'local' with const-qualified type 'const int'}}
+}
+
+void test2 (const int parameter) { // expected-note{{variable 'parameter' declared const here}}
+ parameter = 2; // expected-error{{cannot assign to variable 'parameter' with const-qualified type 'const int'}}
+}
+
+class test3 {
+ int field;
+ const int const_field = 1; // expected-note 2{{non-static data member 'const_field' declared const here}}
+ static const int static_const_field = 1; // expected-note 2{{variable 'static_const_field' declared const here}}
+ void test() {
+ const_field = 4; // expected-error{{cannot assign to non-static data member 'const_field' with const-qualified type 'const int'}}
+ static_const_field = 4; // expected-error{{cannot assign to variable 'static_const_field' with const-qualified type 'const int'}}
+ }
+ void test_const() const { // expected-note 2{{member function 'test3::test_const' is declared const here}}
+ field = 4; // expected-error{{cannot assign to non-static data member within const member function 'test_const'}}
+ const_field = 4 ; // expected-error{{cannot assign to non-static data member 'const_field' with const-qualified type 'const int'}}
+ static_const_field = 4; // expected-error{{cannot assign to variable 'static_const_field' with const-qualified type 'const int'}}
+ }
+};
+
+const int &return_const_ref(); // expected-note{{function 'return_const_ref' which returns const-qualified type 'const int &' declared here}}
+
+void test4() {
+ return_const_ref() = 10; // expected-error{{cannot assign to return value because function 'return_const_ref' returns a const value}}
+}
+
+struct S5 {
+ int field;
+ const int const_field = 4; // expected-note {{non-static data member 'const_field' declared const here}}
+};
+
+void test5() {
+ S5 s5;
+ s5.field = 5;
+ s5.const_field = 5; // expected-error{{cannot assign to non-static data member 'const_field' with const-qualified type 'const int'}}
+}
+
+struct U1 {
+ int a = 5;
+};
+
+struct U2 {
+ U1 u1;
+};
+
+struct U3 {
+ const U2 u2 = U2(); // expected-note{{non-static data member 'u2' declared const here}}
+};
+
+struct U4 {
+ U3 u3;
+};
+
+void test6() {
+ U4 u4;
+ u4.u3.u2.u1.a = 5; // expected-error{{cannot assign to non-static data member 'u2' with const-qualified type 'const U2'}}
+}
+
+struct A {
+ int z;
+};
+struct B {
+ A a;
+};
+struct C {
+ B b;
+ C();
+};
+const C &getc(); // expected-note{{function 'getc' which returns const-qualified type 'const C &' declared here}}
+void test7() {
+ const C c; // expected-note{{variable 'c' declared const here}}
+ c.b.a.z = 5; // expected-error{{cannot assign to variable 'c' with const-qualified type 'const C'}}
+
+ getc().b.a.z = 5; // expected-error{{cannot assign to return value because function 'getc' returns a const value}}
+}
+
+struct D { const int n; }; // expected-note 2{{non-static data member 'n' declared const here}}
+struct E { D *const d = 0; };
+void test8() {
+ extern D *const d;
+ d->n = 0; // expected-error{{cannot assign to non-static data member 'n' with const-qualified type 'const int'}}
+
+ E e;
+ e.d->n = 0; // expected-error{{cannot assign to non-static data member 'n' with const-qualified type 'const int'}}
+}
+
+struct F { int n; };
+struct G { const F *f; }; // expected-note{{non-static data member 'f' declared const here}}
+void test10() {
+ const F *f; // expected-note{{variable 'f' declared const here}}
+ f->n = 0; // expected-error{{cannot assign to variable 'f' with const-qualified type 'const F *'}}
+
+ G g;
+ g.f->n = 0; // expected-error{{cannot assign to non-static data member 'f' with const-qualified type 'const F *'}}
+}
+
+void test11(
+ const int x, // expected-note{{variable 'x' declared const here}}
+ const int& y // expected-note{{variable 'y' declared const here}}
+ ) {
+ x = 5; // expected-error{{cannot assign to variable 'x' with const-qualified type 'const int'}}
+ y = 5; // expected-error{{cannot assign to variable 'y' with const-qualified type 'const int &'}}
+}
+
+struct H {
+ const int a = 0; // expected-note{{non-static data member 'a' declared const here}}
+ const int &b = a; // expected-note{{non-static data member 'b' declared const here}}
+};
+
+void test12(H h) {
+ h.a = 1; // expected-error {{cannot assign to non-static data member 'a' with const-qualified type 'const int'}}
+ h.b = 2; // expected-error {{cannot assign to non-static data member 'b' with const-qualified type 'const int &'}}
+}
Index: cfe/trunk/test/SemaCXX/err_typecheck_assign_const_filecheck.cpp
===================================================================
--- cfe/trunk/test/SemaCXX/err_typecheck_assign_const_filecheck.cpp (revision 0)
+++ cfe/trunk/test/SemaCXX/err_typecheck_assign_const_filecheck.cpp (revision 234677)
@@ -0,0 +1,252 @@
+// RUN: not %clang_cc1 -fsyntax-only -std=c++11 %s 2>&1 | FileCheck %s
+
+struct E {
+ int num;
+ const int Cnum = 0;
+ mutable int Mnum;
+ static int Snum;
+ const static int CSnum;
+};
+
+struct D {
+ E e;
+ const E Ce;
+ mutable E Me;
+ static E Se;
+ const static E CSe;
+ E &getE() const;
+ const E &getCE() const;
+};
+
+struct C {
+ D d;
+ const D Cd;
+ mutable D Md;
+ static D Sd;
+ const static D CSd;
+ D &getD() const;
+ const D &getCD() const;
+};
+
+struct B {
+ C c;
+ const C Cc;
+ mutable C Mc;
+ static C Sc;
+ const static C CSc;
+ C &getC() const;
+ static C &getSC();
+ const C &getCC() const;
+ static const C &getSCC();
+};
+
+struct A {
+ B b;
+ const B Cb;
+ mutable B Mb;
+ static B Sb;
+ const static B CSb;
+ B &getB() const;
+ static B &getSB();
+ const B &getCB() const;
+ static const B &getSCB();
+};
+
+A& getA();
+
+// Valid assignment
+void test1(A a, const A Ca) {
+ a.b.c.d.e.num = 5;
+ a.b.c.d.e.Mnum = 5;
+ Ca.b.c.d.e.Mnum = 5;
+ a.b.c.d.e.Snum = 5;
+ Ca.b.c.d.e.Snum = 5;
+ Ca.b.c.Md.e.num = 5;
+ Ca.Mb.Cc.d.e.Mnum = 5;
+ Ca.Mb.getC().d.e.num = 5;
+ Ca.getSB().c.d.e.num = 5;
+ a.getSCB().c.d.Me.num = 5;
+ Ca.Cb.Cc.Cd.Ce.Snum = 5;
+ // CHECK-NOT: error:
+ // CHECK-NOT: note:
+}
+
+// One note
+void test2(A a, const A Ca) {
+ Ca.b.c.d.e.num = 5;
+ // CHECK-NOT: error:
+ // CHECK: error:{{.*}} 'Ca'
+ // CHECK-NOT: note:
+ // CHECK: note:{{.*}} 'Ca'
+ // CHECK-NOT: note:
+
+ a.Cb.c.d.e.num = 5;
+ // CHECK-NOT: error:
+ // CHECK: error:{{.*}} 'Cb'
+ // CHECK-NOT: note:
+ // CHECK: note:{{.*}} 'Cb'
+ // CHECK-NOT: note:
+
+ a.b.c.Cd.e.num = 5;
+ // CHECK-NOT: error:
+ // CHECK: error:{{.*}} 'Cd'
+ // CHECK-NOT: note:
+ // CHECK: note:{{.*}} 'Cd'
+ // CHECK-NOT: note:
+
+ a.b.c.d.e.CSnum = 5;
+ // CHECK-NOT: error:
+ // CHECK: error:{{.*}} 'CSnum'
+ // CHECK-NOT: note:
+ // CHECK: note:{{.*}} 'CSnum'
+ // CHECK-NOT: note:
+
+ a.b.c.d.e.Cnum = 5;
+ // CHECK-NOT: error:
+ // CHECK: error:{{.*}} 'Cnum'
+ // CHECK-NOT: note:
+ // CHECK: note:{{.*}} 'Cnum'
+ // CHECK-NOT: note:
+
+ a.getCB().c.d.e.num = 5;
+ // CHECK-NOT: error:
+ // CHECK: error:{{.*}} 'getCB'
+ // CHECK-NOT: note:
+ // CHECK: note:{{.*}} 'getCB'
+ // CHECK-NOT: note:
+
+ a.getSCB().c.d.e.num = 5;
+ // CHECK-NOT: error:
+ // CHECK: error:{{.*}} 'getSCB'
+ // CHECK-NOT: note:
+ // CHECK: note:{{.*}} 'getSCB'
+ // CHECK-NOT: note:
+}
+
+// Two notes
+void test3(A a, const A Ca) {
+
+ a.getSCB().Cc.d.e.num = 5;
+ // CHECK-NOT: error:
+ // CHECK: error:{{.*}} 'Cc'
+ // CHECK-NOT: note:
+ // CHECK: note:{{.*}} 'Cc'
+ // CHECK-NOT: note:
+ // CHECK: note:{{.*}} 'getSCB'
+ // CHECK-NOT: note:
+
+ Ca.b.c.Cd.e.num = 5;
+ // CHECK-NOT: error:
+ // CHECK: error:{{.*}} 'Cd'
+ // CHECK-NOT: note:
+ // CHECK: note:{{.*}} 'Cd'
+ // CHECK-NOT: note:
+ // CHECK: note:{{.*}} 'Ca'
+ // CHECK-NOT: note:
+
+ a.getCB().c.Cd.e.num = 5;
+ // CHECK-NOT: error:
+ // CHECK: error:{{.*}} 'Cd'
+ // CHECK-NOT: note:
+ // CHECK: note:{{.*}} 'Cd'
+ // CHECK-NOT: note:
+ // CHECK: note:{{.*}} 'getCB'
+ // CHECK-NOT: note:
+
+ a.b.getCC().d.e.Cnum = 5;
+ // CHECK-NOT: error:
+ // CHECK: error:{{.*}} 'Cnum'
+ // CHECK-NOT: note:
+ // CHECK: note:{{.*}} 'Cnum'
+ // CHECK-NOT: note:
+ // CHECK: note:{{.*}} 'getCC'
+ // CHECK-NOT: note:
+
+ a.b.c.Cd.Ce.num = 5;
+ // CHECK-NOT: error:
+ // CHECK: error:{{.*}} 'Ce'
+ // CHECK-NOT: note:
+ // CHECK: note:{{.*}} 'Ce'
+ // CHECK-NOT: note:
+ // CHECK: note:{{.*}} 'Cd'
+ // CHECK-NOT: note:
+
+ a.b.CSc.Cd.e.num = 5;
+ // CHECK-NOT: error:
+ // CHECK: error:{{.*}} 'Cd'
+ // CHECK-NOT: note:
+ // CHECK: note:{{.*}} 'Cd'
+ // CHECK-NOT: note:
+ // CHECK: note:{{.*}} 'CSc'
+ // CHECK-NOT: note:
+
+ a.CSb.c.Cd.e.num = 5;
+ // CHECK-NOT: error:
+ // CHECK: error:{{.*}} 'Cd'
+ // CHECK-NOT: note:
+ // CHECK: note:{{.*}} 'Cd'
+ // CHECK-NOT: note:
+ // CHECK: note:{{.*}} 'CSb'
+ // CHECK-NOT: note:
+}
+
+// No errors
+void test4(const A Ca) {
+ // Mutable cases
+ Ca.Mb.c.d.e.num = 5;
+ Ca.CSb.Mc.d.e.num = 5;
+ Ca.getCB().Mc.d.e.num = 5;
+ Ca.getSCB().Mc.d.e.num = 5;
+
+ // Returning non-const reference
+ Ca.getB().c.d.e.num = 5;
+ Ca.CSb.getC().d.e.num = 5;
+ Ca.getCB().getC().d.e.num = 5;
+ Ca.getSCB().getC().d.e.num = 5;
+
+ // Returning non-const reference
+ Ca.getSB().c.d.e.num = 5;
+ Ca.CSb.getSC().d.e.num = 5;
+ Ca.getCB().getSC().d.e.num = 5;
+ Ca.getSCB().getSC().d.e.num = 5;
+
+ // Static member
+ Ca.Sb.c.d.e.num = 5;
+ Ca.CSb.Sc.d.e.num = 5;
+ Ca.getCB().Sc.d.e.num = 5;
+ Ca.getSCB().Sc.d.e.num = 5;
+
+ // CHECK-NOT: error:
+ // CHECK-NOT: note:
+}
+
+// Only display notes for relavent cases.
+void test5(const A Ca) {
+ Ca.Mb.c.d.Ce.num = 5;
+ // CHECK-NOT: error:
+ // CHECK: error:{{.*}} 'Ce'
+ // CHECK-NOT: note:
+ // CHECK: note:{{.*}} 'Ce'
+ // CHECK-NOT: note:
+
+ Ca.getB().c.d.Ce.num = 5;
+ // CHECK-NOT: error:
+ // CHECK: error:{{.*}} 'Ce'
+ // CHECK-NOT: note:
+ // CHECK: note:{{.*}} 'Ce'
+ // CHECK-NOT: note:
+
+ Ca.getSB().c.d.Ce.num = 5;
+ // CHECK-NOT: error:
+ // CHECK: error:{{.*}} 'Ce'
+ // CHECK-NOT: note:
+ // CHECK: note:{{.*}} 'Ce'
+ // CHECK-NOT: note:
+
+ Ca.Sb.c.d.Ce.num = 5;
+ // CHECK-NOT: error:
+ // CHECK: error:{{.*}} 'Ce'
+ // CHECK-NOT: note:
+ // CHECK: note:{{.*}} 'Ce'
+ // CHECK-NOT: note:
+}
Index: cfe/trunk/test/SemaCXX/captured-statements.cpp
===================================================================
--- cfe/trunk/test/SemaCXX/captured-statements.cpp (revision 234676)
+++ cfe/trunk/test/SemaCXX/captured-statements.cpp (revision 234677)
@@ -1,173 +1,173 @@
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -fblocks
void test_nest_lambda() {
int x;
int y;
[&,y]() {
int z;
#pragma clang __debug captured
{
x = y; // OK
y = z; // expected-error{{cannot assign to a variable captured by copy in a non-mutable lambda}}
z = y; // OK
}
}();
int a;
#pragma clang __debug captured
{
int b;
int c;
[&,c]() {
a = b; // OK
b = c; // OK
c = a; // expected-error{{cannot assign to a variable captured by copy in a non-mutable lambda}}
}();
}
}
class test_obj_capture {
int a;
void b();
static void test() {
test_obj_capture c;
#pragma clang __debug captured
{ (void)c.a; } // OK
#pragma clang __debug captured
{ c.b(); } // OK
}
};
class test_this_capture {
int a;
void b();
void test() {
#pragma clang __debug captured
{ (void)this; } // OK
#pragma clang __debug captured
{ (void)a; } // OK
#pragma clang __debug captured
{ b(); } // OK
}
};
template <typename T>
void template_capture_var() {
T x; // expected-error{{declaration of reference variable 'x' requires an initializer}}
#pragma clang _debug captured
{
(void)x;
}
}
template <typename T>
class Val {
T v;
public:
void set(const T &v0) {
#pragma clang __debug captured
{
v = v0;
}
}
};
void test_capture_var() {
template_capture_var<int>(); // OK
template_capture_var<int&>(); // expected-note{{in instantiation of function template specialization 'template_capture_var<int &>' requested here}}
Val<float> Obj;
Obj.set(0.0f); // OK
}
template <typename S, typename T>
-S template_capture_var(S x, T y) {
+S template_capture_var(S x, T y) { // expected-note{{variable 'y' declared const here}}
#pragma clang _debug captured
{
x++;
- y++; // expected-error{{read-only variable is not assignable}}
+ y++; // expected-error{{cannot assign to variable 'y' with const-qualified type 'const int'}}
}
return x;
}
// Check if can recover from a template error.
void test_capture_var_error() {
template_capture_var<int, int>(0, 1); // OK
template_capture_var<int, const int>(0, 1); // expected-note{{in instantiation of function template specialization 'template_capture_var<int, const int>' requested here}}
template_capture_var<int, int>(0, 1); // OK
}
template <typename T>
void template_capture_in_lambda() {
T x, y;
[=, &y]() {
#pragma clang __debug captured
{
y += x;
}
}();
}
void test_lambda() {
template_capture_in_lambda<int>(); // OK
}
struct Foo {
void foo() { }
static void bar() { }
};
template <typename T>
void template_capture_func(T &t) {
#pragma clang __debug captured
{
t.foo();
}
#pragma clang __debug captured
{
T::bar();
}
}
void test_template_capture_func() {
Foo Obj;
template_capture_func(Obj);
}
template <typename T>
T captured_sum(const T &a, const T &b) {
T result;
#pragma clang __debug captured
{
result = a + b;
}
return result;
}
template <typename T, typename... Args>
T captured_sum(const T &a, const Args&... args) {
T result;
#pragma clang __debug captured
{
result = a + captured_sum(args...);
}
return result;
}
void test_capture_variadic() {
(void)captured_sum(1, 2, 3); // OK
(void)captured_sum(1, 2, 3, 4, 5); // OK
}
void test_capture_with_attributes() {
[[]] // expected-error {{an attribute list cannot appear here}}
#pragma clang __debug captured
{
}
}
Index: cfe/trunk/test/SemaCXX/anonymous-union.cpp
===================================================================
--- cfe/trunk/test/SemaCXX/anonymous-union.cpp (revision 234676)
+++ cfe/trunk/test/SemaCXX/anonymous-union.cpp (revision 234677)
@@ -1,212 +1,213 @@
// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
struct X {
union {
float f3;
double d2;
} named;
union {
int i;
float f;
union { // expected-warning{{anonymous types declared in an anonymous union are an extension}}
float f2;
mutable double d;
};
};
void test_unqual_references();
struct { // expected-warning{{anonymous structs are a GNU extension}}
int a;
float b;
};
void test_unqual_references_const() const;
mutable union { // expected-error{{anonymous union at class scope must not have a storage specifier}}
float c1;
double c2;
};
};
void X::test_unqual_references() {
i = 0;
f = 0.0;
f2 = f;
d = f;
f3 = 0; // expected-error{{use of undeclared identifier 'f3'}}
a = 0;
}
-void X::test_unqual_references_const() const {
+void X::test_unqual_references_const() const { // expected-note 2{{member function 'X::test_unqual_references_const' is declared const here}}
d = 0.0;
- f2 = 0; // expected-error{{read-only variable is not assignable}}
- a = 0; // expected-error{{read-only variable is not assignable}}
+ f2 = 0; // expected-error{{cannot assign to non-static data member within const member function 'test_unqual_references_const'}}
+ a = 0; // expected-error{{cannot assign to non-static data member within const member function 'test_unqual_references_const'}}
}
void test_unqual_references(X x, const X xc) {
+ // expected-note@-1 2{{variable 'xc' declared const here}}
x.i = 0;
x.f = 0.0;
x.f2 = x.f;
x.d = x.f;
x.f3 = 0; // expected-error{{no member named 'f3'}}
x.a = 0;
xc.d = 0.0;
- xc.f = 0; // expected-error{{read-only variable is not assignable}}
- xc.a = 0; // expected-error{{read-only variable is not assignable}}
+ xc.f = 0; // expected-error{{cannot assign to variable 'xc' with const-qualified type 'const X'}}
+ xc.a = 0; // expected-error{{cannot assign to variable 'xc' with const-qualified type 'const X'}}
}
struct Redecl {
int x; // expected-note{{previous declaration is here}}
class y { };
union {
int x; // expected-error{{member of anonymous union redeclares 'x'}}
float y;
double z; // expected-note{{previous declaration is here}}
double zz; // expected-note{{previous definition is here}}
};
int z; // expected-error{{duplicate member 'z'}}
void zz(); // expected-error{{redefinition of 'zz' as different kind of symbol}}
};
union { // expected-error{{anonymous unions at namespace or global scope must be declared 'static'}}
int int_val;
float float_val;
};
static union {
int int_val2; // expected-note{{previous definition is here}}
float float_val2;
};
void PR21858() {
void int_val2(); // expected-error{{redefinition of 'int_val2' as different kind of symbol}}
}
void f() {
int_val2 = 0;
float_val2 = 0.0;
}
void g() {
union {
int i;
float f2;
};
i = 0;
f2 = 0.0;
}
struct BadMembers {
union {
struct X { }; // expected-error {{types cannot be declared in an anonymous union}}
struct { int x; int y; } y; // expected-warning{{anonymous types declared in an anonymous union are an extension}}
void f(); // expected-error{{functions cannot be declared in an anonymous union}}
private: int x1; // expected-error{{anonymous union cannot contain a private data member}}
protected: float x2; // expected-error{{anonymous union cannot contain a protected data member}}
};
};
// <rdar://problem/6481130>
typedef union { }; // expected-warning{{typedef requires a name}}
// <rdar://problem/7562438>
typedef struct objc_module *Foo ;
typedef struct _s {
union {
int a;
int Foo;
};
} s, *ps;
// <rdar://problem/7987650>
namespace test4 {
class A {
struct { // expected-warning{{anonymous structs are a GNU extension}}
int s0; // expected-note {{declared private here}}
double s1; // expected-note {{declared private here}}
union { // expected-warning{{anonymous types declared in an anonymous struct are an extension}}
int su0; // expected-note {{declared private here}}
double su1; // expected-note {{declared private here}}
};
};
union {
int u0; // expected-note {{declared private here}}
double u1; // expected-note {{declared private here}}
struct { // expected-warning{{anonymous structs are a GNU extension}} expected-warning{{anonymous types declared in an anonymous union are an extension}}
int us0; // expected-note {{declared private here}}
double us1; // expected-note {{declared private here}}
};
};
};
void test() {
A a;
(void) a.s0; // expected-error {{private member}}
(void) a.s1; // expected-error {{private member}}
(void) a.su0; // expected-error {{private member}}
(void) a.su1; // expected-error {{private member}}
(void) a.u0; // expected-error {{private member}}
(void) a.u1; // expected-error {{private member}}
(void) a.us0; // expected-error {{private member}}
(void) a.us1; // expected-error {{private member}}
}
}
typedef void *voidPtr;
void f2() {
union { int **ctxPtr; void **voidPtr; };
}
void foo_PR6741() {
union {
char *m_a;
int *m_b;
};
if(1) {
union {
char *m_a;
int *m_b;
};
}
}
namespace PR8326 {
template <class T>
class Foo {
public:
Foo()
: x(0)
, y(1){
}
private:
const union { // expected-warning{{anonymous union cannot be 'const'}}
struct { // expected-warning{{anonymous structs are a GNU extension}} expected-warning{{declared in an anonymous union}}
T x;
T y;
};
T v[2];
};
};
Foo<int> baz;
}
namespace PR16630 {
struct A { union { int x; float y; }; }; // expected-note {{member is declared here}}
struct B : private A { using A::x; } b; // expected-note 2 {{private}}
void foo () {
b.x = 10;
b.y = 0; // expected-error {{cannot cast 'struct B' to its private base class 'PR16630::A'}} expected-error {{'y' is a private member of 'PR16630::A'}}
}
}
Index: cfe/trunk/test/SemaCXX/function-type-qual.cpp
===================================================================
--- cfe/trunk/test/SemaCXX/function-type-qual.cpp (revision 234676)
+++ cfe/trunk/test/SemaCXX/function-type-qual.cpp (revision 234677)
@@ -1,39 +1,39 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
void f() const; // expected-error {{non-member function cannot have 'const' qualifier}}
void (*pf)() const; // expected-error {{pointer to function type cannot have 'const' qualifier}}
extern void (&rf)() const; // expected-error {{reference to function type cannot have 'const' qualifier}}
typedef void cfn() const;
cfn f2; // expected-error {{non-member function of type 'cfn' (aka 'void () const') cannot have 'const' qualifier}}
class C {
void f() const;
cfn f2;
static void f3() const; // expected-error {{static member function cannot have 'const' qualifier}}
static cfn f4; // expected-error {{static member function of type 'cfn' (aka 'void () const') cannot have 'const' qualifier}}
void m1() {
x = 0;
}
- void m2() const {
- x = 0; // expected-error {{read-only variable is not assignable}}
+ void m2() const { // expected-note {{member function 'C::m2' is declared const here}}
+ x = 0; // expected-error {{cannot assign to non-static data member within const member function 'm2'}}
}
int x;
};
void (C::*mpf)() const;
cfn C::*mpg;
// Don't crash!
void (PR14171)() const; // expected-error {{non-member function cannot have 'const' qualifier}}
// Test template instantiation of decayed array types. Not really related to
// type quals.
template <typename T> void arrayDecay(const T a[]) { }
void instantiateArrayDecay() {
int a[1];
arrayDecay(a);
}
Index: cfe/trunk/test/SemaCXX/cxx0x-constexpr-const.cpp
===================================================================
--- cfe/trunk/test/SemaCXX/cxx0x-constexpr-const.cpp (revision 234676)
+++ cfe/trunk/test/SemaCXX/cxx0x-constexpr-const.cpp (revision 234677)
@@ -1,10 +1,10 @@
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
-constexpr int x = 1;
+constexpr int x = 1; // expected-note {{variable 'x' declared const here}}
constexpr int id(int x) { return x; }
void foo(void) {
- x = 2; // expected-error {{read-only variable is not assignable}}
+ x = 2; // expected-error {{cannot assign to variable 'x' with const-qualified type 'const int'}}
int (*idp)(int) = id;
}
Index: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
===================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (revision 234676)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (revision 234677)
@@ -1,7594 +1,7610 @@
//==--- DiagnosticSemaKinds.td - libsema diagnostics ----------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//===----------------------------------------------------------------------===//
// Semantic Analysis
//===----------------------------------------------------------------------===//
let Component = "Sema" in {
let CategoryName = "Semantic Issue" in {
def note_previous_decl : Note<"%0 declared here">;
def note_entity_declared_at : Note<"%0 declared here">;
def note_callee_decl : Note<"%0 declared here">;
def note_defined_here : Note<"%0 defined here">;
// For loop analysis
def warn_variables_not_in_loop_body : Warning<
"variable%select{s| %1|s %1 and %2|s %1, %2, and %3|s %1, %2, %3, and %4}0 "
"used in loop condition not modified in loop body">,
InGroup<LoopAnalysis>, DefaultIgnore;
def warn_redundant_loop_iteration : Warning<
"variable %0 is %select{decremented|incremented}1 both in the loop header "
"and in the loop body">,
InGroup<LoopAnalysis>, DefaultIgnore;
def note_loop_iteration_here : Note<"%select{decremented|incremented}0 here">;
def warn_duplicate_enum_values : Warning<
"element %0 has been implicitly assigned %1 which another element has "
"been assigned">, InGroup<DiagGroup<"duplicate-enum">>, DefaultIgnore;
def note_duplicate_element : Note<"element %0 also has value %1">;
// Absolute value functions
def warn_unsigned_abs : Warning<
"taking the absolute value of unsigned type %0 has no effect">,
InGroup<AbsoluteValue>;
def note_remove_abs : Note<
"remove the call to '%0' since unsigned values cannot be negative">;
def warn_abs_too_small : Warning<
"absolute value function %0 given an argument of type %1 but has parameter "
"of type %2 which may cause truncation of value">, InGroup<AbsoluteValue>;
def warn_wrong_absolute_value_type : Warning<
"using %select{integer|floating point|complex}1 absolute value function %0 "
"when argument is of %select{integer|floating point|complex}2 type">,
InGroup<AbsoluteValue>;
def note_replace_abs_function : Note<"use function '%0' instead">;
def warn_infinite_recursive_function : Warning<
"all paths through this function will call itself">,
InGroup<InfiniteRecursion>, DefaultIgnore;
// Constant expressions
def err_expr_not_ice : Error<
"expression is not an %select{integer|integral}0 constant expression">;
def ext_expr_not_ice : Extension<
"expression is not an %select{integer|integral}0 constant expression; "
"folding it to a constant is a GNU extension">, InGroup<GNUFoldingConstant>;
def err_typecheck_converted_constant_expression : Error<
"value of type %0 is not implicitly convertible to %1">;
def err_typecheck_converted_constant_expression_disallowed : Error<
"conversion from %0 to %1 is not allowed in a converted constant expression">;
def err_typecheck_converted_constant_expression_indirect : Error<
"conversion from %0 to %1 in converted constant expression would "
"bind reference to a temporary">;
def err_expr_not_cce : Error<
"%select{case value|enumerator value|non-type template argument|array size}0 "
"is not a constant expression">;
def ext_cce_narrowing : ExtWarn<
"%select{case value|enumerator value|non-type template argument|array size}0 "
"%select{cannot be narrowed from type %2 to %3|"
"evaluates to %2, which cannot be narrowed to type %3}1">,
InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
def err_ice_not_integral : Error<
"integral constant expression must have integral or unscoped enumeration "
"type, not %0">;
def err_ice_incomplete_type : Error<
"integral constant expression has incomplete class type %0">;
def err_ice_explicit_conversion : Error<
"integral constant expression requires explicit conversion from %0 to %1">;
def note_ice_conversion_here : Note<
"conversion to %select{integral|enumeration}0 type %1 declared here">;
def err_ice_ambiguous_conversion : Error<
"ambiguous conversion from type %0 to an integral or unscoped "
"enumeration type">;
def err_ice_too_large : Error<
"integer constant expression evaluates to value %0 that cannot be "
"represented in a %1-bit %select{signed|unsigned}2 integer type">;
// Semantic analysis of constant literals.
def ext_predef_outside_function : Warning<
"predefined identifier is only valid inside function">,
InGroup<DiagGroup<"predefined-identifier-outside-function">>;
def warn_float_overflow : Warning<
"magnitude of floating-point constant too large for type %0; maximum is %1">,
InGroup<LiteralRange>;
def warn_float_underflow : Warning<
"magnitude of floating-point constant too small for type %0; minimum is %1">,
InGroup<LiteralRange>;
def warn_double_const_requires_fp64 : Warning<
"double precision constant requires cl_khr_fp64, casting to single precision">;
// C99 variable-length arrays
def ext_vla : Extension<"variable length arrays are a C99 feature">,
InGroup<VLAExtension>;
def warn_vla_used : Warning<"variable length array used">,
InGroup<VLA>, DefaultIgnore;
def err_vla_non_pod : Error<"variable length array of non-POD element type %0">;
def err_vla_in_sfinae : Error<
"variable length array cannot be formed during template argument deduction">;
def err_array_star_in_function_definition : Error<
"variable length array must be bound in function definition">;
def err_vla_decl_in_file_scope : Error<
"variable length array declaration not allowed at file scope">;
def err_vla_decl_has_static_storage : Error<
"variable length array declaration cannot have 'static' storage duration">;
def err_vla_decl_has_extern_linkage : Error<
"variable length array declaration cannot have 'extern' linkage">;
def ext_vla_folded_to_constant : Extension<
"variable length array folded to constant array as an extension">, InGroup<GNUFoldingConstant>;
// C99 variably modified types
def err_variably_modified_template_arg : Error<
"variably modified type %0 cannot be used as a template argument">;
def err_variably_modified_nontype_template_param : Error<
"non-type template parameter of variably modified type %0">;
def err_variably_modified_new_type : Error<
"'new' cannot allocate object of variably modified type %0">;
// C99 Designated Initializers
def ext_designated_init : Extension<
"designated initializers are a C99 feature">, InGroup<C99>;
def err_array_designator_negative : Error<
"array designator value '%0' is negative">;
def err_array_designator_empty_range : Error<
"array designator range [%0, %1] is empty">;
def err_array_designator_non_array : Error<
"array designator cannot initialize non-array type %0">;
def err_array_designator_too_large : Error<
"array designator index (%0) exceeds array bounds (%1)">;
def err_field_designator_non_aggr : Error<
"field designator cannot initialize a "
"%select{non-struct, non-union|non-class}0 type %1">;
def err_field_designator_unknown : Error<
"field designator %0 does not refer to any field in type %1">;
def err_field_designator_nonfield : Error<
"field designator %0 does not refer to a non-static data member">;
def note_field_designator_found : Note<"field designator refers here">;
def err_designator_for_scalar_init : Error<
"designator in initializer for scalar type %0">;
def warn_subobject_initializer_overrides : Warning<
"subobject initialization overrides initialization of other fields "
"within its enclosing subobject">, InGroup<InitializerOverrides>;
def warn_initializer_overrides : Warning<
"initializer overrides prior initialization of this subobject">,
InGroup<InitializerOverrides>;
def note_previous_initializer : Note<
"previous initialization %select{|with side effects }0is here"
"%select{| (side effects may not occur at run time)}0">;
def err_designator_into_flexible_array_member : Error<
"designator into flexible array member subobject">;
def note_flexible_array_member : Note<
"initialized flexible array member %0 is here">;
def ext_flexible_array_init : Extension<
"flexible array initialization is a GNU extension">, InGroup<GNUFlexibleArrayInitializer>;
// Declarations.
def err_bad_variable_name : Error<
"%0 cannot be the name of a variable or data member">;
def err_bad_parameter_name : Error<
"%0 cannot be the name of a parameter">;
def err_parameter_name_omitted : Error<"parameter name omitted">;
def warn_unused_parameter : Warning<"unused parameter %0">,
InGroup<UnusedParameter>, DefaultIgnore;
def warn_unused_variable : Warning<"unused variable %0">,
InGroup<UnusedVariable>, DefaultIgnore;
def warn_unused_local_typedef : Warning<
"unused %select{typedef|type alias}0 %1">,
InGroup<UnusedLocalTypedef>, DefaultIgnore;
def warn_unused_property_backing_ivar :
Warning<"ivar %0 which backs the property is not "
"referenced in this property's accessor">,
InGroup<UnusedPropertyIvar>, DefaultIgnore;
def warn_unused_const_variable : Warning<"unused variable %0">,
InGroup<UnusedConstVariable>, DefaultIgnore;
def warn_unused_exception_param : Warning<"unused exception parameter %0">,
InGroup<UnusedExceptionParameter>, DefaultIgnore;
def warn_decl_in_param_list : Warning<
"declaration of %0 will not be visible outside of this function">,
InGroup<Visibility>;
def warn_redefinition_in_param_list : Warning<
"redefinition of %0 will not be visible outside of this function">,
InGroup<Visibility>;
def warn_empty_parens_are_function_decl : Warning<
"empty parentheses interpreted as a function declaration">,
InGroup<VexingParse>;
def warn_parens_disambiguated_as_function_declaration : Warning<
"parentheses were disambiguated as a function declaration">,
InGroup<VexingParse>;
def note_additional_parens_for_variable_declaration : Note<
"add a pair of parentheses to declare a variable">;
def note_empty_parens_function_call : Note<
"change this ',' to a ';' to call %0">;
def note_empty_parens_default_ctor : Note<
"remove parentheses to declare a variable">;
def note_empty_parens_zero_initialize : Note<
"replace parentheses with an initializer to declare a variable">;
def warn_unused_function : Warning<"unused function %0">,
InGroup<UnusedFunction>, DefaultIgnore;
def warn_unused_member_function : Warning<"unused member function %0">,
InGroup<UnusedMemberFunction>, DefaultIgnore;
def warn_used_but_marked_unused: Warning<"%0 was marked unused but was used">,
InGroup<UsedButMarkedUnused>, DefaultIgnore;
def warn_unneeded_internal_decl : Warning<
"%select{function|variable}0 %1 is not needed and will not be emitted">,
InGroup<UnneededInternalDecl>, DefaultIgnore;
def warn_unneeded_static_internal_decl : Warning<
"'static' function %0 declared in header file "
"should be declared 'static inline'">,
InGroup<UnneededInternalDecl>, DefaultIgnore;
def warn_unneeded_member_function : Warning<
"member function %0 is not needed and will not be emitted">,
InGroup<UnneededMemberFunction>, DefaultIgnore;
def warn_unused_private_field: Warning<"private field %0 is not used">,
InGroup<UnusedPrivateField>, DefaultIgnore;
def warn_parameter_size: Warning<
"%0 is a large (%1 bytes) pass-by-value argument; "
"pass it by reference instead ?">, InGroup<LargeByValueCopy>;
def warn_return_value_size: Warning<
"return value of %0 is a large (%1 bytes) pass-by-value object; "
"pass it by reference instead ?">, InGroup<LargeByValueCopy>;
def warn_return_value_udt: Warning<
"%0 has C-linkage specified, but returns user-defined type %1 which is "
"incompatible with C">, InGroup<ReturnTypeCLinkage>;
def warn_return_value_udt_incomplete: Warning<
"%0 has C-linkage specified, but returns incomplete type %1 which could be "
"incompatible with C">, InGroup<ReturnTypeCLinkage>;
def warn_implicit_function_decl : Warning<
"implicit declaration of function %0">,
InGroup<ImplicitFunctionDeclare>, DefaultIgnore;
def ext_implicit_function_decl : ExtWarn<
"implicit declaration of function %0 is invalid in C99">,
InGroup<ImplicitFunctionDeclare>;
def note_function_suggestion : Note<"did you mean %0?">;
def err_ellipsis_first_param : Error<
"ISO C requires a named parameter before '...'">;
def err_declarator_need_ident : Error<"declarator requires an identifier">;
def err_language_linkage_spec_unknown : Error<"unknown linkage language">;
def err_language_linkage_spec_not_ascii : Error<
"string literal in language linkage specifier cannot have an "
"encoding-prefix">;
def warn_use_out_of_scope_declaration : Warning<
"use of out-of-scope declaration of %0">;
def err_inline_non_function : Error<
"'inline' can only appear on functions">;
def err_noreturn_non_function : Error<
"'_Noreturn' can only appear on functions">;
def warn_qual_return_type : Warning<
"'%0' type qualifier%s1 on return type %plural{1:has|:have}1 no effect">,
InGroup<IgnoredQualifiers>, DefaultIgnore;
def warn_decl_shadow :
Warning<"declaration shadows a %select{"
"local variable|"
"variable in %2|"
"static data member of %2|"
"field of %2}1">,
InGroup<Shadow>, DefaultIgnore;
// C++ using declarations
def err_using_requires_qualname : Error<
"using declaration requires a qualified name">;
def err_using_typename_non_type : Error<
"'typename' keyword used on a non-type">;
def err_using_dependent_value_is_type : Error<
"dependent using declaration resolved to type without 'typename'">;
def err_using_decl_nested_name_specifier_is_not_class : Error<
"using declaration in class refers into '%0', which is not a class">;
def err_using_decl_nested_name_specifier_is_current_class : Error<
"using declaration refers to its own class">;
def err_using_decl_nested_name_specifier_is_not_base_class : Error<
"using declaration refers into '%0', which is not a base class of %1">;
def err_using_decl_constructor_not_in_direct_base : Error<
"%0 is not a direct base of %1, cannot inherit constructors">;
def err_using_decl_constructor_conflict : Error<
"cannot inherit constructor, already inherited constructor with "
"the same signature">;
def note_using_decl_constructor_conflict_current_ctor : Note<
"conflicting constructor">;
def note_using_decl_constructor_conflict_previous_ctor : Note<
"previous constructor">;
def note_using_decl_constructor_conflict_previous_using : Note<
"previously inherited here">;
def warn_using_decl_constructor_ellipsis : Warning<
"inheriting constructor does not inherit ellipsis">,
InGroup<DiagGroup<"inherited-variadic-ctor">>;
def note_using_decl_constructor_ellipsis : Note<
"constructor declared with ellipsis here">;
def err_using_decl_can_not_refer_to_class_member : Error<
"using declaration cannot refer to class member">;
def note_using_decl_class_member_workaround : Note<
"use %select{an alias declaration|a typedef declaration|a reference}0 "
"instead">;
def err_using_decl_can_not_refer_to_namespace : Error<
"using declaration cannot refer to namespace">;
def err_using_decl_constructor : Error<
"using declaration cannot refer to a constructor">;
def warn_cxx98_compat_using_decl_constructor : Warning<
"inheriting constructors are incompatible with C++98">,
InGroup<CXX98Compat>, DefaultIgnore;
def err_using_decl_destructor : Error<
"using declaration cannot refer to a destructor">;
def err_using_decl_template_id : Error<
"using declaration cannot refer to a template specialization">;
def note_using_decl_target : Note<"target of using declaration">;
def note_using_decl_conflict : Note<"conflicting declaration">;
def err_using_decl_redeclaration : Error<"redeclaration of using decl">;
def err_using_decl_conflict : Error<
"target of using declaration conflicts with declaration already in scope">;
def err_using_decl_conflict_reverse : Error<
"declaration conflicts with target of using declaration already in scope">;
def note_using_decl : Note<"%select{|previous }0using declaration">;
def warn_access_decl_deprecated : Warning<
"access declarations are deprecated; use using declarations instead">,
InGroup<Deprecated>;
def err_access_decl : Error<
"ISO C++11 does not allow access declarations; "
"use using declarations instead">;
def warn_exception_spec_deprecated : Warning<
"dynamic exception specifications are deprecated">,
InGroup<Deprecated>, DefaultIgnore;
def note_exception_spec_deprecated : Note<"use '%0' instead">;
def warn_deprecated_copy_operation : Warning<
"definition of implicit copy %select{constructor|assignment operator}1 "
"for %0 is deprecated because it has a user-declared "
"%select{copy %select{assignment operator|constructor}1|destructor}2">,
InGroup<Deprecated>, DefaultIgnore;
def warn_global_constructor : Warning<
"declaration requires a global constructor">,
InGroup<GlobalConstructors>, DefaultIgnore;
def warn_global_destructor : Warning<
"declaration requires a global destructor">,
InGroup<GlobalConstructors>, DefaultIgnore;
def warn_exit_time_destructor : Warning<
"declaration requires an exit-time destructor">,
InGroup<ExitTimeDestructors>, DefaultIgnore;
def err_invalid_thread : Error<
"'%0' is only allowed on variable declarations">;
def err_thread_non_global : Error<
"'%0' variables must have global storage">;
def err_thread_unsupported : Error<
"thread-local storage is not supported for the current target">;
def warn_maybe_falloff_nonvoid_function : Warning<
"control may reach end of non-void function">,
InGroup<ReturnType>;
def warn_falloff_nonvoid_function : Warning<
"control reaches end of non-void function">,
InGroup<ReturnType>;
def err_maybe_falloff_nonvoid_block : Error<
"control may reach end of non-void block">;
def err_falloff_nonvoid_block : Error<
"control reaches end of non-void block">;
def warn_suggest_noreturn_function : Warning<
"%select{function|method}0 %1 could be declared with attribute 'noreturn'">,
InGroup<MissingNoreturn>, DefaultIgnore;
def warn_suggest_noreturn_block : Warning<
"block could be declared with attribute 'noreturn'">,
InGroup<MissingNoreturn>, DefaultIgnore;
// Unreachable code.
def warn_unreachable : Warning<
"code will never be executed">,
InGroup<UnreachableCode>, DefaultIgnore;
def warn_unreachable_break : Warning<
"'break' will never be executed">,
InGroup<UnreachableCodeBreak>, DefaultIgnore;
def warn_unreachable_return : Warning<
"'return' will never be executed">,
InGroup<UnreachableCodeReturn>, DefaultIgnore;
def warn_unreachable_loop_increment : Warning<
"loop will run at most once (loop increment never executed)">,
InGroup<UnreachableCodeLoopIncrement>, DefaultIgnore;
def note_unreachable_silence : Note<
"silence by adding parentheses to mark code as explicitly dead">;
/// Built-in functions.
def ext_implicit_lib_function_decl : ExtWarn<
"implicitly declaring library function '%0' with type %1">;
def note_include_header_or_declare : Note<
"include the header <%0> or explicitly provide a declaration for '%1'">;
def note_previous_builtin_declaration : Note<"%0 is a builtin with type %1">;
def warn_implicit_decl_requires_sysheader : Warning<
"declaration of built-in function '%1' requires inclusion of the header <%0>">,
InGroup<BuiltinRequiresHeader>;
def warn_redecl_library_builtin : Warning<
"incompatible redeclaration of library function %0">,
InGroup<DiagGroup<"incompatible-library-redeclaration">>;
def err_builtin_definition : Error<"definition of builtin function %0">;
def warn_builtin_unknown : Warning<"use of unknown builtin %0">,
InGroup<ImplicitFunctionDeclare>, DefaultError;
def warn_dyn_class_memaccess : Warning<
"%select{destination for|source of|first operand of|second operand of}0 this "
"%1 call is a pointer to %select{|class containing a }2dynamic class %3; "
"vtable pointer will be %select{overwritten|copied|moved|compared}4">,
InGroup<DiagGroup<"dynamic-class-memaccess">>;
def note_bad_memaccess_silence : Note<
"explicitly cast the pointer to silence this warning">;
def warn_sizeof_pointer_expr_memaccess : Warning<
"'%0' call operates on objects of type %1 while the size is based on a "
"different type %2">,
InGroup<SizeofPointerMemaccess>;
def warn_sizeof_pointer_expr_memaccess_note : Note<
"did you mean to %select{dereference the argument to 'sizeof' (and multiply "
"it by the number of elements)|remove the addressof in the argument to "
"'sizeof' (and multiply it by the number of elements)|provide an explicit "
"length}0?">;
def warn_sizeof_pointer_type_memaccess : Warning<
"argument to 'sizeof' in %0 call is the same pointer type %1 as the "
"%select{destination|source}2; expected %3 or an explicit length">,
InGroup<SizeofPointerMemaccess>;
def warn_strlcpycat_wrong_size : Warning<
"size argument in %0 call appears to be size of the source; "
"expected the size of the destination">,
InGroup<DiagGroup<"strlcpy-strlcat-size">>;
def note_strlcpycat_wrong_size : Note<
"change size argument to be the size of the destination">;
def warn_memsize_comparison : Warning<
"size argument in %0 call is a comparison">,
InGroup<DiagGroup<"memsize-comparison">>;
def note_memsize_comparison_paren : Note<
"did you mean to compare the result of %0 instead?">;
def note_memsize_comparison_cast_silence : Note<
"explicitly cast the argument to size_t to silence this warning">;
def warn_strncat_large_size : Warning<
"the value of the size argument in 'strncat' is too large, might lead to a "
"buffer overflow">, InGroup<StrncatSize>;
def warn_strncat_src_size : Warning<"size argument in 'strncat' call appears "
"to be size of the source">, InGroup<StrncatSize>;
def warn_strncat_wrong_size : Warning<
"the value of the size argument to 'strncat' is wrong">, InGroup<StrncatSize>;
def note_strncat_wrong_size : Note<
"change the argument to be the free space in the destination buffer minus "
"the terminating null byte">;
def warn_assume_side_effects : Warning<
"the argument to %0 has side effects that will be discarded">,
InGroup<DiagGroup<"assume">>;
def warn_memcpy_chk_overflow : Warning<
"%0 will always overflow destination buffer">,
InGroup<DiagGroup<"builtin-memcpy-chk-size">>;
/// main()
// static main() is not an error in C, just in C++.
def warn_static_main : Warning<"'main' should not be declared static">,
InGroup<Main>;
def err_static_main : Error<"'main' is not allowed to be declared static">;
def err_inline_main : Error<"'main' is not allowed to be declared inline">;
def ext_noreturn_main : ExtWarn<
"'main' is not allowed to be declared _Noreturn">, InGroup<Main>;
def note_main_remove_noreturn : Note<"remove '_Noreturn'">;
def err_constexpr_main : Error<
"'main' is not allowed to be declared constexpr">;
def err_deleted_main : Error<"'main' is not allowed to be deleted">;
def err_mainlike_template_decl : Error<"%0 cannot be a template">;
def err_main_returns_nonint : Error<"'main' must return 'int'">;
def ext_main_returns_nonint : ExtWarn<"return type of 'main' is not 'int'">,
InGroup<MainReturnType>;
def note_main_change_return_type : Note<"change return type to 'int'">;
def err_main_surplus_args : Error<"too many parameters (%0) for 'main': "
"must be 0, 2, or 3">;
def warn_main_one_arg : Warning<"only one parameter on 'main' declaration">,
InGroup<Main>;
def err_main_arg_wrong : Error<"%select{first|second|third|fourth}0 "
"parameter of 'main' (%select{argument count|argument array|environment|"
"platform-specific data}0) must be of type %1">;
def ext_main_used : Extension<
"ISO C++ does not allow 'main' to be used by a program">, InGroup<Main>;
/// parser diagnostics
def ext_no_declarators : ExtWarn<"declaration does not declare anything">,
InGroup<MissingDeclarations>;
def ext_typedef_without_a_name : ExtWarn<"typedef requires a name">,
InGroup<MissingDeclarations>;
def err_typedef_not_identifier : Error<"typedef name must be an identifier">;
def err_typedef_changes_linkage : Error<"unsupported: typedef changes linkage"
" of anonymous type, but linkage was already computed">;
def note_typedef_changes_linkage : Note<"use a tag name here to establish "
"linkage prior to definition">;
def err_statically_allocated_object : Error<
"interface type cannot be statically allocated">;
def err_object_cannot_be_passed_returned_by_value : Error<
"interface type %1 cannot be %select{returned|passed}0 by value"
"; did you forget * in %1?">;
def err_parameters_retval_cannot_have_fp16_type : Error<
"%select{parameters|function return value}0 cannot have __fp16 type; did you forget * ?">;
def err_opencl_half_load_store : Error<
"%select{loading directly from|assigning directly to}0 pointer to type %1 is not allowed">;
def err_opencl_cast_to_half : Error<"casting to type %0 is not allowed">;
def err_opencl_half_declaration : Error<
"declaring variable of type %0 is not allowed">;
def err_opencl_half_param : Error<
"declaring function parameter of type %0 is not allowed; did you forget * ?">;
def err_opencl_half_return : Error<
"declaring function return value of type %0 is not allowed; did you forget * ?">;
def warn_enum_value_overflow : Warning<"overflow in enumeration value">;
def warn_pragma_options_align_reset_failed : Warning<
"#pragma options align=reset failed: %0">,
InGroup<IgnoredPragmas>;
def err_pragma_options_align_mac68k_target_unsupported : Error<
"mac68k alignment pragma is not supported on this target">;
def warn_pragma_pack_invalid_alignment : Warning<
"expected #pragma pack parameter to be '1', '2', '4', '8', or '16'">,
InGroup<IgnoredPragmas>;
// Follow the MSVC implementation.
def warn_pragma_pack_show : Warning<"value of #pragma pack(show) == %0">;
def warn_pragma_pack_pop_identifer_and_alignment : Warning<
"specifying both a name and alignment to 'pop' is undefined">;
def warn_pragma_pop_failed : Warning<"#pragma %0(pop, ...) failed: %1">,
InGroup<IgnoredPragmas>;
def warn_cxx_ms_struct :
Warning<"ms_struct may not produce MSVC-compatible layouts for classes "
"with base classes or virtual functions">,
DefaultError, InGroup<IncompatibleMSStruct>;
def err_section_conflict : Error<"%0 causes a section type conflict with %1">;
def err_no_base_classes : Error<"invalid use of '__super', %0 has no base classes">;
def err_invalid_super_scope : Error<"invalid use of '__super', "
"this keyword can only be used inside class or member function scope">;
def err_super_in_lambda_unsupported : Error<
"use of '__super' inside a lambda is unsupported">;
def warn_pragma_unused_undeclared_var : Warning<
"undeclared variable %0 used as an argument for '#pragma unused'">,
InGroup<IgnoredPragmas>;
def warn_pragma_unused_expected_var_arg : Warning<
"only variables can be arguments to '#pragma unused'">,
InGroup<IgnoredPragmas>;
def err_pragma_push_visibility_mismatch : Error<
"#pragma visibility push with no matching #pragma visibility pop">;
def note_surrounding_namespace_ends_here : Note<
"surrounding namespace with visibility attribute ends here">;
def err_pragma_pop_visibility_mismatch : Error<
"#pragma visibility pop with no matching #pragma visibility push">;
def note_surrounding_namespace_starts_here : Note<
"surrounding namespace with visibility attribute starts here">;
def err_pragma_loop_invalid_argument_type : Error<
"invalid argument of type %0; expected an integer type">;
def err_pragma_loop_invalid_argument_value : Error<
"%select{invalid value '%0'; must be positive|value '%0' is too large}1">;
def err_pragma_loop_compatibility : Error<
"%select{incompatible|duplicate}0 directives '%1' and '%2'">;
def err_pragma_loop_precedes_nonloop : Error<
"expected a for, while, or do-while loop to follow '%0'">;
/// Objective-C parser diagnostics
def err_duplicate_class_def : Error<
"duplicate interface definition for class %0">;
def err_undef_superclass : Error<
"cannot find interface declaration for %0, superclass of %1">;
def err_forward_superclass : Error<
"attempting to use the forward class %0 as superclass of %1">;
def err_no_nsconstant_string_class : Error<
"cannot find interface declaration for %0">;
def err_recursive_superclass : Error<
"trying to recursively use %0 as superclass of %1">;
def err_conflicting_aliasing_type : Error<"conflicting types for alias %0">;
def warn_undef_interface : Warning<"cannot find interface declaration for %0">;
def warn_duplicate_protocol_def : Warning<"duplicate protocol definition of %0 is ignored">;
def err_protocol_has_circular_dependency : Error<
"protocol has circular dependency">;
def err_undeclared_protocol : Error<"cannot find protocol declaration for %0">;
def warn_undef_protocolref : Warning<"cannot find protocol definition for %0">;
def warn_atprotocol_protocol : Warning<
"@protocol is using a forward protocol declaration of %0">, InGroup<AtProtocol>;
def warn_readonly_property : Warning<
"attribute 'readonly' of property %0 restricts attribute "
"'readwrite' of property inherited from %1">,
InGroup<PropertyAttr>;
def warn_property_attribute : Warning<
"'%1' attribute on property %0 does not match the property inherited from %2">,
InGroup<PropertyAttr>;
def warn_property_types_are_incompatible : Warning<
"property type %0 is incompatible with type %1 inherited from %2">,
InGroup<DiagGroup<"incompatible-property-type">>;
def warn_protocol_property_mismatch : Warning<
"property of type %0 was selected for synthesis">,
InGroup<DiagGroup<"protocol-property-synthesis-ambiguity">>;
def err_undef_interface : Error<"cannot find interface declaration for %0">;
def err_category_forward_interface : Error<
"cannot define %select{category|class extension}0 for undefined class %1">;
def err_class_extension_after_impl : Error<
"cannot declare class extension for %0 after class implementation">;
def note_implementation_declared : Note<
"class implementation is declared here">;
def note_while_in_implementation : Note<
"detected while default synthesizing properties in class implementation">;
def note_class_declared : Note<
"class is declared here">;
def note_receiver_class_declared : Note<
"receiver is instance of class declared here">;
def note_receiver_expr_here : Note<
"receiver expression is here">;
def note_receiver_is_id : Note<
"receiver is treated with 'id' type for purpose of method lookup">;
def note_suppressed_class_declare : Note<
"class with specified objc_requires_property_definitions attribute is declared here">;
def err_objc_root_class_subclass : Error<
"objc_root_class attribute may only be specified on a root class declaration">;
def warn_objc_root_class_missing : Warning<
"class %0 defined without specifying a base class">,
InGroup<ObjCRootClass>;
def note_objc_needs_superclass : Note<
"add a super class to fix this problem">;
def warn_dup_category_def : Warning<
"duplicate definition of category %1 on interface %0">;
def err_conflicting_super_class : Error<"conflicting super class name %0">;
def err_dup_implementation_class : Error<"reimplementation of class %0">;
def err_dup_implementation_category : Error<
"reimplementation of category %1 for class %0">;
def err_conflicting_ivar_type : Error<
"instance variable %0 has conflicting type%diff{: $ vs $|}1,2">;
def err_duplicate_ivar_declaration : Error<
"instance variable is already declared">;
def warn_on_superclass_use : Warning<
"class implementation may not have super class">;
def err_conflicting_ivar_bitwidth : Error<
"instance variable %0 has conflicting bit-field width">;
def err_conflicting_ivar_name : Error<
"conflicting instance variable names: %0 vs %1">;
def err_inconsistent_ivar_count : Error<
"inconsistent number of instance variables specified">;
def warn_undef_method_impl : Warning<"method definition for %0 not found">,
InGroup<DiagGroup<"incomplete-implementation">>;
def warn_conflicting_overriding_ret_types : Warning<
"conflicting return type in "
"declaration of %0%diff{: $ vs $|}1,2">,
InGroup<OverridingMethodMismatch>, DefaultIgnore;
def warn_conflicting_ret_types : Warning<
"conflicting return type in "
"implementation of %0%diff{: $ vs $|}1,2">,
InGroup<MismatchedReturnTypes>;
def warn_conflicting_overriding_ret_type_modifiers : Warning<
"conflicting distributed object modifiers on return type "
"in declaration of %0">,
InGroup<OverridingMethodMismatch>, DefaultIgnore;
def warn_conflicting_ret_type_modifiers : Warning<
"conflicting distributed object modifiers on return type "
"in implementation of %0">,
InGroup<DistributedObjectModifiers>;
def warn_non_covariant_overriding_ret_types : Warning<
"conflicting return type in "
"declaration of %0: %1 vs %2">,
InGroup<OverridingMethodMismatch>, DefaultIgnore;
def warn_non_covariant_ret_types : Warning<
"conflicting return type in "
"implementation of %0: %1 vs %2">,
InGroup<MethodSignatures>, DefaultIgnore;
def warn_conflicting_overriding_param_types : Warning<
"conflicting parameter types in "
"declaration of %0%diff{: $ vs $|}1,2">,
InGroup<OverridingMethodMismatch>, DefaultIgnore;
def warn_conflicting_param_types : Warning<
"conflicting parameter types in "
"implementation of %0%diff{: $ vs $|}1,2">,
InGroup<MismatchedParameterTypes>;
def warn_conflicting_param_modifiers : Warning<
"conflicting distributed object modifiers on parameter type "
"in implementation of %0">,
InGroup<DistributedObjectModifiers>;
def warn_conflicting_overriding_param_modifiers : Warning<
"conflicting distributed object modifiers on parameter type "
"in declaration of %0">,
InGroup<OverridingMethodMismatch>, DefaultIgnore;
def warn_non_contravariant_overriding_param_types : Warning<
"conflicting parameter types in "
"declaration of %0: %1 vs %2">,
InGroup<OverridingMethodMismatch>, DefaultIgnore;
def warn_non_contravariant_param_types : Warning<
"conflicting parameter types in "
"implementation of %0: %1 vs %2">,
InGroup<MethodSignatures>, DefaultIgnore;
def warn_conflicting_overriding_variadic :Warning<
"conflicting variadic declaration of method and its "
"implementation">,
InGroup<OverridingMethodMismatch>, DefaultIgnore;
def warn_conflicting_variadic :Warning<
"conflicting variadic declaration of method and its "
"implementation">;
def warn_category_method_impl_match:Warning<
"category is implementing a method which will also be implemented"
" by its primary class">, InGroup<ObjCProtocolMethodImpl>;
def warn_implements_nscopying : Warning<
"default assign attribute on property %0 which implements "
"NSCopying protocol is not appropriate with -fobjc-gc[-only]">;
def warn_multiple_method_decl : Warning<"multiple methods named %0 found">,
InGroup<ObjCMultipleMethodNames>;
def warn_strict_multiple_method_decl : Warning<
"multiple methods named %0 found">, InGroup<StrictSelector>, DefaultIgnore;
def warn_accessor_property_type_mismatch : Warning<
"type of property %0 does not match type of accessor %1">;
def not_conv_function_declared_at : Note<"type conversion function declared here">;
def note_method_declared_at : Note<"method %0 declared here">;
def note_property_attribute : Note<"property %0 is declared "
"%select{deprecated|unavailable|partial}1 here">;
def err_setter_type_void : Error<"type of setter must be void">;
def err_duplicate_method_decl : Error<"duplicate declaration of method %0">;
def warn_duplicate_method_decl :
Warning<"multiple declarations of method %0 found and ignored">,
InGroup<MethodDuplicate>, DefaultIgnore;
def warn_objc_cdirective_format_string :
Warning<"using %0 directive in %select{NSString|CFString}1 "
"which is being passed as a formatting argument to the formatting "
"%select{method|CFfunction}2">,
InGroup<ObjCCStringFormat>, DefaultIgnore;
def err_objc_var_decl_inclass :
Error<"cannot declare variable inside @interface or @protocol">;
def error_missing_method_context : Error<
"missing context for method declaration">;
def err_objc_property_attr_mutually_exclusive : Error<
"property attributes '%0' and '%1' are mutually exclusive">;
def err_objc_property_requires_object : Error<
"property with '%0' attribute must be of object type">;
def warn_objc_property_no_assignment_attribute : Warning<
"no 'assign', 'retain', or 'copy' attribute is specified - "
"'assign' is assumed">,
InGroup<ObjCPropertyNoAttribute>;
def warn_objc_isa_use : Warning<
"direct access to Objective-C's isa is deprecated in favor of "
"object_getClass()">, InGroup<DeprecatedObjCIsaUsage>;
def warn_objc_isa_assign : Warning<
"assignment to Objective-C's isa is deprecated in favor of "
"object_setClass()">, InGroup<DeprecatedObjCIsaUsage>;
def warn_objc_pointer_masking : Warning<
"bitmasking for introspection of Objective-C object pointers is strongly "
"discouraged">,
InGroup<ObjCPointerIntrospect>;
def warn_objc_pointer_masking_performSelector : Warning<warn_objc_pointer_masking.Text>,
InGroup<ObjCPointerIntrospectPerformSelector>;
def warn_objc_property_default_assign_on_object : Warning<
"default property attribute 'assign' not appropriate for non-GC object">,
InGroup<ObjCPropertyNoAttribute>;
def warn_property_attr_mismatch : Warning<
"property attribute in class extension does not match the primary class">,
InGroup<PropertyAttr>;
def warn_property_implicitly_mismatched : Warning <
"primary property declaration is implicitly strong while redeclaration "
"in class extension is weak">,
InGroup<DiagGroup<"objc-property-implicit-mismatch">>;
def warn_objc_property_copy_missing_on_block : Warning<
"'copy' attribute must be specified for the block property "
"when -fobjc-gc-only is specified">;
def warn_objc_property_retain_of_block : Warning<
"retain'ed block property does not copy the block "
"- use copy attribute instead">, InGroup<ObjCRetainBlockProperty>;
def warn_objc_readonly_property_has_setter : Warning<
"setter cannot be specified for a readonly property">,
InGroup<ObjCReadonlyPropertyHasSetter>;
def warn_atomic_property_rule : Warning<
"writable atomic property %0 cannot pair a synthesized %select{getter|setter}1 "
"with a user defined %select{getter|setter}2">,
InGroup<DiagGroup<"atomic-property-with-user-defined-accessor">>;
def note_atomic_property_fixup_suggest : Note<"setter and getter must both be "
"synthesized, or both be user defined,or the property must be nonatomic">;
def err_atomic_property_nontrivial_assign_op : Error<
"atomic property of reference type %0 cannot have non-trivial assignment"
" operator">;
def warn_cocoa_naming_owned_rule : Warning<
"property follows Cocoa naming"
" convention for returning 'owned' objects">,
InGroup<DiagGroup<"objc-property-matches-cocoa-ownership-rule">>;
def err_cocoa_naming_owned_rule : Error<
"property follows Cocoa naming"
" convention for returning 'owned' objects">;
def note_cocoa_naming_declare_family : Note<
"explicitly declare getter %objcinstance0 with '%1' to return an 'unowned' "
"object">;
def warn_auto_synthesizing_protocol_property :Warning<
"auto property synthesis will not synthesize property %0"
" declared in protocol %1">,
InGroup<DiagGroup<"objc-protocol-property-synthesis">>;
def warn_no_autosynthesis_shared_ivar_property : Warning <
"auto property synthesis will not synthesize property "
"%0 because it cannot share an ivar with another synthesized property">,
InGroup<ObjCNoPropertyAutoSynthesis>;
def warn_no_autosynthesis_property : Warning<
"auto property synthesis will not synthesize property "
"%0 because it is 'readwrite' but it will be synthesized 'readonly' "
"via another property">,
InGroup<ObjCNoPropertyAutoSynthesis>;
def warn_autosynthesis_property_in_superclass : Warning<
"auto property synthesis will not synthesize property "
"%0; it will be implemented by its superclass, use @dynamic to "
"acknowledge intention">,
InGroup<ObjCNoPropertyAutoSynthesis>;
def warn_autosynthesis_property_ivar_match :Warning<
"autosynthesized property %0 will use %select{|synthesized}1 instance variable "
"%2, not existing instance variable %3">,
InGroup<DiagGroup<"objc-autosynthesis-property-ivar-name-match">>;
def warn_missing_explicit_synthesis : Warning <
"auto property synthesis is synthesizing property not explicitly synthesized">,
InGroup<DiagGroup<"objc-missing-property-synthesis">>, DefaultIgnore;
def warn_property_getter_owning_mismatch : Warning<
"property declared as returning non-retained objects"
"; getter returning retained objects">;
def error_property_setter_ambiguous_use : Error<
"synthesized properties %0 and %1 both claim setter %2 -"
" use of this setter will cause unexpected behavior">;
def warn_default_atomic_custom_getter_setter : Warning<
"atomic by default property %0 has a user defined %select{getter|setter}1 "
"(property should be marked 'atomic' if this is intended)">,
InGroup<CustomAtomic>, DefaultIgnore;
def err_use_continuation_class : Error<
"illegal redeclaration of property in class extension %0"
" (attribute must be 'readwrite', while its primary must be 'readonly')">;
def err_type_mismatch_continuation_class : Error<
"type of property %0 in class extension does not match "
"property type in primary class">;
def err_use_continuation_class_redeclaration_readwrite : Error<
"illegal redeclaration of 'readwrite' property in class extension %0"
" (perhaps you intended this to be a 'readwrite' redeclaration of a "
"'readonly' public property?)">;
def err_continuation_class : Error<"class extension has no primary class">;
def err_property_type : Error<"property cannot have array or function type %0">;
def error_missing_property_context : Error<
"missing context for property implementation declaration">;
def error_bad_property_decl : Error<
"property implementation must have its declaration in interface %0">;
def error_category_property : Error<
"property declared in category %0 cannot be implemented in "
"class implementation">;
def note_property_declare : Note<
"property declared here">;
def note_protocol_property_declare : Note<
"it could also be property of type %0 declared here">;
def note_property_synthesize : Note<
"property synthesized here">;
def error_synthesize_category_decl : Error<
"@synthesize not allowed in a category's implementation">;
def error_reference_property : Error<
"property of reference type is not supported">;
def error_missing_property_interface : Error<
"property implementation in a category with no category declaration">;
def error_bad_category_property_decl : Error<
"property implementation must have its declaration in the category %0">;
def error_bad_property_context : Error<
"property implementation must be in a class or category implementation">;
def error_missing_property_ivar_decl : Error<
"synthesized property %0 must either be named the same as a compatible"
" instance variable or must explicitly name an instance variable">;
def error_synthesize_weak_non_arc_or_gc : Error<
"@synthesize of 'weak' property is only allowed in ARC or GC mode">;
def err_arc_perform_selector_retains : Error<
"performSelector names a selector which retains the object">;
def warn_arc_perform_selector_leaks : Warning<
"performSelector may cause a leak because its selector is unknown">,
InGroup<DiagGroup<"arc-performSelector-leaks">>;
def warn_dealloc_in_category : Warning<
"-dealloc is being overridden in a category">,
InGroup<DeallocInCategory>;
def err_gc_weak_property_strong_type : Error<
"weak attribute declared on a __strong type property in GC mode">;
def warn_receiver_is_weak : Warning <
"weak %select{receiver|property|implicit property}0 may be "
"unpredictably set to nil">,
InGroup<DiagGroup<"receiver-is-weak">>, DefaultIgnore;
def warn_arc_repeated_use_of_weak : Warning <
"weak %select{variable|property|implicit property|instance variable}0 %1 is "
"accessed multiple times in this %select{function|method|block|lambda}2 "
"but may be unpredictably set to nil; assign to a strong variable to keep "
"the object alive">,
InGroup<ARCRepeatedUseOfWeak>, DefaultIgnore;
def warn_implicitly_retains_self : Warning <
"block implicitly retains 'self'; explicitly mention 'self' to indicate "
"this is intended behavior">,
InGroup<DiagGroup<"implicit-retain-self">>, DefaultIgnore;
def warn_arc_possible_repeated_use_of_weak : Warning <
"weak %select{variable|property|implicit property|instance variable}0 %1 may "
"be accessed multiple times in this %select{function|method|block|lambda}2 "
"and may be unpredictably set to nil; assign to a strong variable to keep "
"the object alive">,
InGroup<ARCRepeatedUseOfWeakMaybe>, DefaultIgnore;
def note_arc_weak_also_accessed_here : Note<
"also accessed here">;
def err_incomplete_synthesized_property : Error<
"cannot synthesize property %0 with incomplete type %1">;
def error_property_ivar_type : Error<
"type of property %0 (%1) does not match type of instance variable %2 (%3)">;
def error_property_accessor_type : Error<
"type of property %0 (%1) does not match type of accessor %2 (%3)">;
def error_ivar_in_superclass_use : Error<
"property %0 attempting to use instance variable %1 declared in super class %2">;
def error_weak_property : Error<
"existing instance variable %1 for __weak property %0 must be __weak">;
def error_strong_property : Error<
"existing instance variable %1 for strong property %0 may not be __weak">;
def error_dynamic_property_ivar_decl : Error<
"dynamic property cannot have instance variable specification">;
def error_duplicate_ivar_use : Error<
"synthesized properties %0 and %1 both claim instance variable %2">;
def error_property_implemented : Error<"property %0 is already implemented">;
def warn_objc_missing_super_call : Warning<
"method possibly missing a [super %0] call">,
InGroup<ObjCMissingSuperCalls>;
def error_dealloc_bad_result_type : Error<
"dealloc return type must be correctly specified as 'void' under ARC, "
"instead of %0">;
def warn_undeclared_selector : Warning<
"undeclared selector %0">, InGroup<UndeclaredSelector>, DefaultIgnore;
def warn_undeclared_selector_with_typo : Warning<
"undeclared selector %0; did you mean %1?">,
InGroup<UndeclaredSelector>, DefaultIgnore;
def warn_implicit_atomic_property : Warning<
"property is assumed atomic by default">, InGroup<ImplicitAtomic>, DefaultIgnore;
def note_auto_readonly_iboutlet_fixup_suggest : Note<
"property should be changed to be readwrite">;
def warn_auto_readonly_iboutlet_property : Warning<
"readonly IBOutlet property %0 when auto-synthesized may "
"not work correctly with 'nib' loader">,
InGroup<DiagGroup<"readonly-iboutlet-property">>;
def warn_auto_implicit_atomic_property : Warning<
"property is assumed atomic when auto-synthesizing the property">,
InGroup<ImplicitAtomic>, DefaultIgnore;
def warn_unimplemented_selector: Warning<
"no method with selector %0 is implemented in this translation unit">,
InGroup<Selector>, DefaultIgnore;
def warn_unimplemented_protocol_method : Warning<
"method %0 in protocol %1 not implemented">, InGroup<Protocol>;
def warning_multiple_selectors: Warning<
"several methods with selector %0 of mismatched types are found "
"for the @selector expression">,
InGroup<SelectorTypeMismatch>, DefaultIgnore;
// C++ declarations
def err_static_assert_expression_is_not_constant : Error<
"static_assert expression is not an integral constant expression">;
def err_static_assert_failed : Error<"static_assert failed%select{ %1|}0">;
def ext_static_assert_no_message : ExtWarn<
"static_assert with no message is a C++1z extension">, InGroup<CXX1z>;
def warn_cxx14_compat_static_assert_no_message : Warning<
"static_assert with no message is incompatible with C++ standards before C++1z">,
DefaultIgnore, InGroup<CXXPre1zCompat>;
def warn_inline_namespace_reopened_noninline : Warning<
"inline namespace cannot be reopened as a non-inline namespace">;
def err_inline_namespace_mismatch : Error<
"%select{|non-}0inline namespace "
"cannot be reopened as %select{non-|}0inline">;
def err_unexpected_friend : Error<
"friends can only be classes or functions">;
def ext_enum_friend : ExtWarn<
"befriending enumeration type %0 is a C++11 extension">, InGroup<CXX11>;
def warn_cxx98_compat_enum_friend : Warning<
"befriending enumeration type %0 is incompatible with C++98">,
InGroup<CXX98Compat>, DefaultIgnore;
def ext_nonclass_type_friend : ExtWarn<
"non-class friend type %0 is a C++11 extension">, InGroup<CXX11>;
def warn_cxx98_compat_nonclass_type_friend : Warning<
"non-class friend type %0 is incompatible with C++98">,
InGroup<CXX98Compat>, DefaultIgnore;
def err_friend_is_member : Error<
"friends cannot be members of the declaring class">;
def warn_cxx98_compat_friend_is_member : Warning<
"friend declaration naming a member of the declaring class is incompatible "
"with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
def ext_unelaborated_friend_type : ExtWarn<
"unelaborated friend declaration is a C++11 extension; specify "
"'%select{struct|interface|union|class|enum}0' to befriend %1">,
InGroup<CXX11>;
def warn_cxx98_compat_unelaborated_friend_type : Warning<
"befriending %1 without '%select{struct|interface|union|class|enum}0' "
"keyword is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
def err_qualified_friend_not_found : Error<
"no function named %0 with type %1 was found in the specified scope">;
def err_introducing_special_friend : Error<
"must use a qualified name when declaring a %select{constructor|"
"destructor|conversion operator}0 as a friend">;
def err_tagless_friend_type_template : Error<
"friend type templates must use an elaborated type">;
def err_no_matching_local_friend : Error<
"no matching function found in local scope">;
def err_no_matching_local_friend_suggest : Error<
"no matching function %0 found in local scope; did you mean %3?">;
def err_partial_specialization_friend : Error<
"partial specialization cannot be declared as a friend">;
def err_qualified_friend_def : Error<
"friend function definition cannot be qualified with '%0'">;
def err_friend_def_in_local_class : Error<
"friend function cannot be defined in a local class">;
def err_friend_not_first_in_declaration : Error<
"'friend' must appear first in a non-function declaration">;
def err_using_decl_friend : Error<
"cannot befriend target of using declaration">;
def warn_template_qualified_friend_unsupported : Warning<
"dependent nested name specifier '%0' for friend class declaration is "
"not supported; turning off access control for %1">,
InGroup<UnsupportedFriend>;
def warn_template_qualified_friend_ignored : Warning<
"dependent nested name specifier '%0' for friend template declaration is "
"not supported; ignoring this friend declaration">,
InGroup<UnsupportedFriend>;
def ext_friend_tag_redecl_outside_namespace : ExtWarn<
"unqualified friend declaration referring to type outside of the nearest "
"enclosing namespace is a Microsoft extension; add a nested name specifier">,
InGroup<Microsoft>;
def err_invalid_member_in_interface : Error<
"%select{data member |non-public member function |static member function |"
"user-declared constructor|user-declared destructor|operator |"
"nested class }0%1 is not permitted within an interface type">;
def err_invalid_base_in_interface : Error<
"interface type cannot inherit from "
"%select{'struct|non-public 'interface|'class}0 %1'">;
def err_abstract_type_in_decl : Error<
"%select{return|parameter|variable|field|instance variable|"
"synthesized instance variable}0 type %1 is an abstract class">;
def err_allocation_of_abstract_type : Error<
"allocating an object of abstract class type %0">;
def err_throw_abstract_type : Error<
"cannot throw an object of abstract type %0">;
def err_array_of_abstract_type : Error<"array of abstract class type %0">;
def err_capture_of_abstract_type : Error<
"by-copy capture of value of abstract type %0">;
def err_capture_of_incomplete_type : Error<
"by-copy capture of variable %0 with incomplete type %1">;
def err_capture_default_non_local : Error<
"non-local lambda expression cannot have a capture-default">;
def err_multiple_final_overriders : Error<
"virtual function %q0 has more than one final overrider in %1">;
def note_final_overrider : Note<"final overrider of %q0 in %1">;
def err_type_defined_in_type_specifier : Error<
"%0 cannot be defined in a type specifier">;
def err_type_defined_in_result_type : Error<
"%0 cannot be defined in the result type of a function">;
def err_type_defined_in_param_type : Error<
"%0 cannot be defined in a parameter type">;
def err_type_defined_in_alias_template : Error<
"%0 cannot be defined in a type alias template">;
def note_pure_virtual_function : Note<
"unimplemented pure virtual method %0 in %1">;
def err_deleted_decl_not_first : Error<
"deleted definition must be first declaration">;
def err_deleted_override : Error<
"deleted function %0 cannot override a non-deleted function">;
def err_non_deleted_override : Error<
"non-deleted function %0 cannot override a deleted function">;
def warn_weak_vtable : Warning<
"%0 has no out-of-line virtual method definitions; its vtable will be "
"emitted in every translation unit">,
InGroup<DiagGroup<"weak-vtables">>, DefaultIgnore;
def warn_weak_template_vtable : Warning<
"explicit template instantiation %0 will emit a vtable in every "
"translation unit">,
InGroup<DiagGroup<"weak-template-vtables">>, DefaultIgnore;
def ext_using_undefined_std : ExtWarn<
"using directive refers to implicitly-defined namespace 'std'">;
// C++ exception specifications
def err_exception_spec_in_typedef : Error<
"exception specifications are not allowed in %select{typedefs|type aliases}0">;
def err_distant_exception_spec : Error<
"exception specifications are not allowed beyond a single level "
"of indirection">;
def err_incomplete_in_exception_spec : Error<
"%select{|pointer to |reference to }0incomplete type %1 is not allowed "
"in exception specification">;
def err_rref_in_exception_spec : Error<
"rvalue reference type %0 is not allowed in exception specification">;
def err_mismatched_exception_spec : Error<
"exception specification in declaration does not match previous declaration">;
def ext_mismatched_exception_spec : ExtWarn<
"exception specification in declaration does not match previous declaration">,
InGroup<Microsoft>;
def err_override_exception_spec : Error<
"exception specification of overriding function is more lax than "
"base version">;
def ext_override_exception_spec : ExtWarn<
"exception specification of overriding function is more lax than "
"base version">, InGroup<Microsoft>;
def err_incompatible_exception_specs : Error<
"target exception specification is not superset of source">;
def err_deep_exception_specs_differ : Error<
"exception specifications of %select{return|argument}0 types differ">;
def warn_missing_exception_specification : Warning<
"%0 is missing exception specification '%1'">;
def err_noexcept_needs_constant_expression : Error<
"argument to noexcept specifier must be a constant expression">;
def err_exception_spec_not_parsed : Error<
"exception specification is not available until end of class definition">;
// C++ access checking
def err_class_redeclared_with_different_access : Error<
"%0 redeclared with '%1' access">;
def err_access : Error<
"%1 is a %select{private|protected}0 member of %3">, AccessControl;
def ext_ms_using_declaration_inaccessible : ExtWarn<
"using declaration referring to inaccessible member '%0' (which refers "
"to accessible member '%1') is a Microsoft compatibility extension">,
AccessControl, InGroup<Microsoft>;
def err_access_ctor : Error<
"calling a %select{private|protected}0 constructor of class %2">,
AccessControl;
def ext_rvalue_to_reference_access_ctor : Extension<
"C++98 requires an accessible copy constructor for class %2 when binding "
"a reference to a temporary; was %select{private|protected}0">,
AccessControl, InGroup<BindToTemporaryCopy>;
def err_access_base_ctor : Error<
// The ERRORs represent other special members that aren't constructors, in
// hopes that someone will bother noticing and reporting if they appear
"%select{base class|inherited virtual base class}0 %1 has %select{private|"
"protected}3 %select{default |copy |move |*ERROR* |*ERROR* "
"|*ERROR*|}2constructor">, AccessControl;
def err_access_field_ctor : Error<
// The ERRORs represent other special members that aren't constructors, in
// hopes that someone will bother noticing and reporting if they appear
"field of type %0 has %select{private|protected}2 "
"%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}1constructor">,
AccessControl;
def err_access_friend_function : Error<
"friend function %1 is a %select{private|protected}0 member of %3">,
AccessControl;
def err_access_dtor : Error<
"calling a %select{private|protected}1 destructor of class %0">,
AccessControl;
def err_access_dtor_base :
Error<"base class %0 has %select{private|protected}1 destructor">,
AccessControl;
def err_access_dtor_vbase :
Error<"inherited virtual base class %1 has "
"%select{private|protected}2 destructor">,
AccessControl;
def err_access_dtor_temp :
Error<"temporary of type %0 has %select{private|protected}1 destructor">,
AccessControl;
def err_access_dtor_exception :
Error<"exception object of type %0 has %select{private|protected}1 "
"destructor">, AccessControl;
def err_access_dtor_field :
Error<"field of type %1 has %select{private|protected}2 destructor">,
AccessControl;
def err_access_dtor_var :
Error<"variable of type %1 has %select{private|protected}2 destructor">,
AccessControl;
def err_access_dtor_ivar :
Error<"instance variable of type %0 has %select{private|protected}1 "
"destructor">,
AccessControl;
def note_previous_access_declaration : Note<
"previously declared '%1' here">;
def note_access_natural : Note<
"%select{|implicitly }1declared %select{private|protected}0 here">;
def note_access_constrained_by_path : Note<
"constrained by %select{|implicitly }1%select{private|protected}0"
" inheritance here">;
def note_access_protected_restricted_noobject : Note<
"must name member using the type of the current context %0">;
def note_access_protected_restricted_ctordtor : Note<
"protected %select{constructor|destructor}0 can only be used to "
"%select{construct|destroy}0 a base class subobject">;
def note_access_protected_restricted_object : Note<
"can only access this member on an object of type %0">;
def warn_cxx98_compat_sfinae_access_control : Warning<
"substitution failure due to access control is incompatible with C++98">,
InGroup<CXX98Compat>, DefaultIgnore, NoSFINAE;
// C++ name lookup
def err_incomplete_nested_name_spec : Error<
"incomplete type %0 named in nested name specifier">;
def err_dependent_nested_name_spec : Error<
"nested name specifier for a declaration cannot depend on a template "
"parameter">;
def err_nested_name_member_ref_lookup_ambiguous : Error<
"lookup of %0 in member access expression is ambiguous">;
def ext_nested_name_member_ref_lookup_ambiguous : ExtWarn<
"lookup of %0 in member access expression is ambiguous; using member of %1">,
InGroup<AmbigMemberTemplate>;
def note_ambig_member_ref_object_type : Note<
"lookup in the object type %0 refers here">;
def note_ambig_member_ref_scope : Note<
"lookup from the current scope refers here">;
def err_qualified_member_nonclass : Error<
"qualified member access refers to a member in %0">;
def err_incomplete_member_access : Error<
"member access into incomplete type %0">;
def err_incomplete_type : Error<
"incomplete type %0 where a complete type is required">;
def warn_cxx98_compat_enum_nested_name_spec : Warning<
"enumeration type in nested name specifier is incompatible with C++98">,
InGroup<CXX98Compat>, DefaultIgnore;
def err_nested_name_spec_is_not_class : Error<
"%0 cannot appear before '::' because it is not a class"
"%select{ or namespace|, namespace, or enumeration}1; did you mean ':'?">;
def ext_nested_name_spec_is_enum : ExtWarn<
"use of enumeration in a nested name specifier is a C++11 extension">,
InGroup<CXX11>;
// C++ class members
def err_storageclass_invalid_for_member : Error<
"storage class specified for a member declaration">;
def err_mutable_function : Error<"'mutable' cannot be applied to functions">;
def err_mutable_reference : Error<"'mutable' cannot be applied to references">;
def ext_mutable_reference : ExtWarn<
"'mutable' on a reference type is a Microsoft extension">,
InGroup<Microsoft>;
def err_mutable_const : Error<"'mutable' and 'const' cannot be mixed">;
def err_mutable_nonmember : Error<
"'mutable' can only be applied to member variables">;
def err_virtual_non_function : Error<
"'virtual' can only appear on non-static member functions">;
def err_virtual_out_of_class : Error<
"'virtual' can only be specified inside the class definition">;
def err_virtual_member_function_template : Error<
"'virtual' cannot be specified on member function templates">;
def err_static_overrides_virtual : Error<
"'static' member function %0 overrides a virtual function in a base class">;
def err_explicit_non_function : Error<
"'explicit' can only appear on non-static member functions">;
def err_explicit_out_of_class : Error<
"'explicit' can only be specified inside the class definition">;
def err_explicit_non_ctor_or_conv_function : Error<
"'explicit' can only be applied to a constructor or conversion function">;
def err_static_not_bitfield : Error<"static member %0 cannot be a bit-field">;
def err_static_out_of_line : Error<
"'static' can only be specified inside the class definition">;
def err_storage_class_for_static_member : Error<
"static data member definition cannot specify a storage class">;
def err_typedef_not_bitfield : Error<"typedef member %0 cannot be a bit-field">;
def err_not_integral_type_bitfield : Error<
"bit-field %0 has non-integral type %1">;
def err_not_integral_type_anon_bitfield : Error<
"anonymous bit-field has non-integral type %0">;
def err_member_function_initialization : Error<
"initializer on function does not look like a pure-specifier">;
def err_non_virtual_pure : Error<
"%0 is not virtual and cannot be declared pure">;
def ext_pure_function_definition : ExtWarn<
"function definition with pure-specifier is a Microsoft extension">,
InGroup<Microsoft>;
def err_implicit_object_parameter_init : Error<
"cannot initialize object parameter of type %0 with an expression "
"of type %1">;
def err_qualified_member_of_unrelated : Error<
"%q0 is not a member of class %1">;
def warn_call_to_pure_virtual_member_function_from_ctor_dtor : Warning<
"call to pure virtual member function %0; overrides of %0 in subclasses are "
"not available in the %select{constructor|destructor}1 of %2">;
def note_member_declared_at : Note<"member is declared here">;
def note_ivar_decl : Note<"instance variable is declared here">;
def note_bitfield_decl : Note<"bit-field is declared here">;
def note_implicit_param_decl : Note<"%0 is an implicit parameter">;
def note_member_synthesized_at : Note<
"implicit %select{default constructor|copy constructor|move constructor|copy "
"assignment operator|move assignment operator|destructor}0 for %1 first "
"required here">;
def note_inhctor_synthesized_at : Note<
"inheriting constructor for %0 first required here">;
def err_missing_default_ctor : Error<
"%select{|implicit default |inheriting }0constructor for %1 must explicitly "
"initialize the %select{base class|member}2 %3 which does not have a default "
"constructor">;
def note_due_to_dllexported_class : Note<
"due to '%0' being dllexported%select{|; try compiling in C++11 mode}1">;
def err_illegal_union_or_anon_struct_member : Error<
"%select{anonymous struct|union}0 member %1 has a non-trivial "
"%select{constructor|copy constructor|move constructor|copy assignment "
"operator|move assignment operator|destructor}2">;
def warn_cxx98_compat_nontrivial_union_or_anon_struct_member : Warning<
"%select{anonymous struct|union}0 member %1 with a non-trivial "
"%select{constructor|copy constructor|move constructor|copy assignment "
"operator|move assignment operator|destructor}2 is incompatible with C++98">,
InGroup<CXX98Compat>, DefaultIgnore;
def note_nontrivial_virtual_dtor : Note<
"destructor for %0 is not trivial because it is virtual">;
def note_nontrivial_has_virtual : Note<
"because type %0 has a virtual %select{member function|base class}1">;
def note_nontrivial_no_def_ctor : Note<
"because %select{base class of |field of |}0type %1 has no "
"default constructor">;
def note_user_declared_ctor : Note<
"implicit default constructor suppressed by user-declared constructor">;
def note_nontrivial_no_copy : Note<
"because no %select{<<ERROR>>|constructor|constructor|assignment operator|"
"assignment operator|<<ERROR>>}2 can be used to "
"%select{<<ERROR>>|copy|move|copy|move|<<ERROR>>}2 "
"%select{base class|field|an object}0 of type %3">;
def note_nontrivial_user_provided : Note<
"because %select{base class of |field of |}0type %1 has a user-provided "
"%select{default constructor|copy constructor|move constructor|"
"copy assignment operator|move assignment operator|destructor}2">;
def note_nontrivial_in_class_init : Note<
"because field %0 has an initializer">;
def note_nontrivial_param_type : Note<
"because its parameter is %diff{of type $, not $|of the wrong type}2,3">;
def note_nontrivial_default_arg : Note<"because it has a default argument">;
def note_nontrivial_variadic : Note<"because it is a variadic function">;
def note_nontrivial_subobject : Note<
"because the function selected to %select{construct|copy|move|copy|move|"
"destroy}2 %select{base class|field}0 of type %1 is not trivial">;
def note_nontrivial_objc_ownership : Note<
"because type %0 has a member with %select{no|no|__strong|__weak|"
"__autoreleasing}1 ownership">;
def err_static_data_member_not_allowed_in_anon_struct : Error<
"static data member %0 not allowed in anonymous struct">;
def ext_static_data_member_in_union : ExtWarn<
"static data member %0 in union is a C++11 extension">, InGroup<CXX11>;
def warn_cxx98_compat_static_data_member_in_union : Warning<
"static data member %0 in union is incompatible with C++98">,
InGroup<CXX98Compat>, DefaultIgnore;
def ext_union_member_of_reference_type : ExtWarn<
"union member %0 has reference type %1, which is a Microsoft extension">,
InGroup<Microsoft>;
def err_union_member_of_reference_type : Error<
"union member %0 has reference type %1">;
def ext_anonymous_struct_union_qualified : Extension<
"anonymous %select{struct|union}0 cannot be '%1'">;
def err_different_return_type_for_overriding_virtual_function : Error<
"virtual function %0 has a different return type "
"%diff{($) than the function it overrides (which has return type $)|"
"than the function it overrides}1,2">;
def note_overridden_virtual_function : Note<
"overridden virtual function is here">;
def err_conflicting_overriding_cc_attributes : Error<
"virtual function %0 has different calling convention attributes "
"%diff{($) than the function it overrides (which has calling convention $)|"
"than the function it overrides}1,2">;
def err_covariant_return_inaccessible_base : Error<
"invalid covariant return for virtual function: %1 is a "
"%select{private|protected}2 base class of %0">, AccessControl;
def err_covariant_return_ambiguous_derived_to_base_conv : Error<
"return type of virtual function %3 is not covariant with the return type of "
"the function it overrides (ambiguous conversion from derived class "
"%0 to base class %1:%2)">;
def err_covariant_return_not_derived : Error<
"return type of virtual function %0 is not covariant with the return type of "
"the function it overrides (%1 is not derived from %2)">;
def err_covariant_return_incomplete : Error<
"return type of virtual function %0 is not covariant with the return type of "
"the function it overrides (%1 is incomplete)">;
def err_covariant_return_type_different_qualifications : Error<
"return type of virtual function %0 is not covariant with the return type of "
"the function it overrides (%1 has different qualifiers than %2)">;
def err_covariant_return_type_class_type_more_qualified : Error<
"return type of virtual function %0 is not covariant with the return type of "
"the function it overrides (class type %1 is more qualified than class "
"type %2">;
// C++ constructors
def err_constructor_cannot_be : Error<"constructor cannot be declared '%0'">;
def err_invalid_qualified_constructor : Error<
"'%0' qualifier is not allowed on a constructor">;
def err_ref_qualifier_constructor : Error<
"ref-qualifier '%select{&&|&}0' is not allowed on a constructor">;
def err_constructor_return_type : Error<
"constructor cannot have a return type">;
def err_constructor_redeclared : Error<"constructor cannot be redeclared">;
def err_constructor_byvalue_arg : Error<
"copy constructor must pass its first argument by reference">;
def warn_no_constructor_for_refconst : Warning<
"%select{struct|interface|union|class|enum}0 %1 does not declare any "
"constructor to initialize its non-modifiable members">;
def note_refconst_member_not_initialized : Note<
"%select{const|reference}0 member %1 will never be initialized">;
def ext_ms_explicit_constructor_call : ExtWarn<
"explicit constructor calls are a Microsoft extension">, InGroup<Microsoft>;
// C++ destructors
def err_destructor_not_member : Error<
"destructor must be a non-static member function">;
def err_destructor_cannot_be : Error<"destructor cannot be declared '%0'">;
def err_invalid_qualified_destructor : Error<
"'%0' qualifier is not allowed on a destructor">;
def err_ref_qualifier_destructor : Error<
"ref-qualifier '%select{&&|&}0' is not allowed on a destructor">;
def err_destructor_return_type : Error<"destructor cannot have a return type">;
def err_destructor_redeclared : Error<"destructor cannot be redeclared">;
def err_destructor_with_params : Error<"destructor cannot have any parameters">;
def err_destructor_variadic : Error<"destructor cannot be variadic">;
def err_destructor_typedef_name : Error<
"destructor cannot be declared using a %select{typedef|type alias}1 %0 of the class name">;
def err_destructor_name : Error<
"expected the class name after '~' to name the enclosing class">;
def err_destructor_class_name : Error<
"expected the class name after '~' to name a destructor">;
def err_ident_in_dtor_not_a_type : Error<
"identifier %0 in object destruction expression does not name a type">;
def err_destructor_expr_type_mismatch : Error<
"destructor type %0 in object destruction expression does not match the "
"type %1 of the object being destroyed">;
def note_destructor_type_here : Note<
"type %0 is declared here">;
def err_destructor_template : Error<
"destructor cannot be declared as a template">;
// C++ initialization
def err_init_conversion_failed : Error<
"cannot initialize %select{a variable|a parameter|return object|an "
"exception object|a member subobject|an array element|a new value|a value|a "
"base class|a constructor delegation|a vector element|a block element|a "
"complex element|a lambda capture|a compound literal initializer|a "
"related result|a parameter of CF audited function}0 "
"%diff{of type $ with an %select{rvalue|lvalue}2 of type $|"
"with an %select{rvalue|lvalue}2 of incompatible type}1,3"
"%select{|: different classes%diff{ ($ vs $)|}5,6"
"|: different number of parameters (%5 vs %6)"
"|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
"|: different return type%diff{ ($ vs $)|}5,6"
"|: different qualifiers ("
"%select{none|const|restrict|const and restrict|volatile|const and volatile|"
"volatile and restrict|const, volatile, and restrict}5 vs "
"%select{none|const|restrict|const and restrict|volatile|const and volatile|"
"volatile and restrict|const, volatile, and restrict}6)}4">;
def err_lvalue_to_rvalue_ref : Error<"rvalue reference %diff{to type $ cannot "
"bind to lvalue of type $|cannot bind to incompatible lvalue}0,1">;
def err_lvalue_reference_bind_to_initlist : Error<
"%select{non-const|volatile}0 lvalue reference to type %1 cannot bind to an "
"initializer list temporary">;
def err_lvalue_reference_bind_to_temporary : Error<
"%select{non-const|volatile}0 lvalue reference %diff{to type $ cannot bind "
"to a temporary of type $|cannot bind to incompatible temporary}1,2">;
def err_lvalue_reference_bind_to_unrelated : Error<
"%select{non-const|volatile}0 lvalue reference "
"%diff{to type $ cannot bind to a value of unrelated type $|"
"cannot bind to a value of unrelated type}1,2">;
def err_reference_bind_drops_quals : Error<
"binding of reference %diff{to type $ to a value of type $ drops qualifiers|"
"drops qualifiers}0,1">;
def err_reference_bind_failed : Error<
"reference %diff{to type $ could not bind to an %select{rvalue|lvalue}1 of "
"type $|could not bind to %select{rvalue|lvalue}1 of incompatible type}0,2">;
def err_reference_bind_init_list : Error<
"reference to type %0 cannot bind to an initializer list">;
def warn_temporary_array_to_pointer_decay : Warning<
"pointer is initialized by a temporary array, which will be destroyed at the "
"end of the full-expression">,
InGroup<DiagGroup<"address-of-array-temporary">>;
def err_init_list_bad_dest_type : Error<
"%select{|non-aggregate }0type %1 cannot be initialized with an initializer "
"list">;
def err_member_function_call_bad_cvr : Error<"member function %0 not viable: "
"'this' argument has type %1, but function is not marked "
"%select{const|restrict|const or restrict|volatile|const or volatile|"
"volatile or restrict|const, volatile, or restrict}2">;
def err_reference_bind_to_bitfield : Error<
"%select{non-const|volatile}0 reference cannot bind to "
"bit-field%select{| %1}2">;
def err_reference_bind_to_vector_element : Error<
"%select{non-const|volatile}0 reference cannot bind to vector element">;
def err_reference_var_requires_init : Error<
"declaration of reference variable %0 requires an initializer">;
def err_reference_without_init : Error<
"reference to type %0 requires an initializer">;
def note_value_initialization_here : Note<
"in value-initialization of type %0 here">;
def err_reference_has_multiple_inits : Error<
"reference cannot be initialized with multiple values">;
def err_init_non_aggr_init_list : Error<
"initialization of non-aggregate type %0 with an initializer list">;
def err_init_reference_member_uninitialized : Error<
"reference member of type %0 uninitialized">;
def note_uninit_reference_member : Note<
"uninitialized reference member is here">;
def warn_field_is_uninit : Warning<"field %0 is uninitialized when used here">,
InGroup<Uninitialized>;
def warn_base_class_is_uninit : Warning<
"base class %0 is uninitialized when used here to access %q1">,
InGroup<Uninitialized>;
def warn_reference_field_is_uninit : Warning<
"reference %0 is not yet bound to a value when used here">,
InGroup<Uninitialized>;
def note_uninit_in_this_constructor : Note<
"during field initialization in %select{this|the implicit default}0 "
"constructor">;
def warn_static_self_reference_in_init : Warning<
"static variable %0 is suspiciously used within its own initialization">,
InGroup<UninitializedStaticSelfInit>;
def warn_uninit_self_reference_in_init : Warning<
"variable %0 is uninitialized when used within its own initialization">,
InGroup<Uninitialized>;
def warn_uninit_self_reference_in_reference_init : Warning<
"reference %0 is not yet bound to a value when used within its own"
" initialization">,
InGroup<Uninitialized>;
def warn_uninit_var : Warning<
"variable %0 is uninitialized when %select{used here|captured by block}1">,
InGroup<Uninitialized>, DefaultIgnore;
def warn_sometimes_uninit_var : Warning<
"variable %0 is %select{used|captured}1 uninitialized whenever "
"%select{'%3' condition is %select{true|false}4|"
"'%3' loop %select{is entered|exits because its condition is false}4|"
"'%3' loop %select{condition is true|exits because its condition is false}4|"
"switch %3 is taken|"
"its declaration is reached|"
"%3 is called}2">,
InGroup<UninitializedSometimes>, DefaultIgnore;
def warn_maybe_uninit_var : Warning<
"variable %0 may be uninitialized when "
"%select{used here|captured by block}1">,
InGroup<UninitializedMaybe>, DefaultIgnore;
def note_uninit_var_def : Note<"variable %0 is declared here">;
def note_uninit_var_use : Note<
"%select{uninitialized use occurs|variable is captured by block}0 here">;
def warn_uninit_byref_blockvar_captured_by_block : Warning<
"block pointer variable %0 is uninitialized when captured by block">,
InGroup<Uninitialized>, DefaultIgnore;
def note_block_var_fixit_add_initialization : Note<
"did you mean to use __block %0?">;
def note_in_omitted_aggregate_initializer : Note<
"in implicit initialization of %select{array element %1|field %1}0 "
"with omitted initializer">;
def note_in_reference_temporary_list_initializer : Note<
"in initialization of temporary of type %0 created to "
"list-initialize this reference">;
def note_var_fixit_add_initialization : Note<
"initialize the variable %0 to silence this warning">;
def note_uninit_fixit_remove_cond : Note<
"remove the %select{'%1' if its condition|condition if it}0 "
"is always %select{false|true}2">;
def err_init_incomplete_type : Error<"initialization of incomplete type %0">;
def warn_unsequenced_mod_mod : Warning<
"multiple unsequenced modifications to %0">, InGroup<Unsequenced>;
def warn_unsequenced_mod_use : Warning<
"unsequenced modification and access to %0">, InGroup<Unsequenced>;
def err_temp_copy_no_viable : Error<
"no viable constructor %select{copying variable|copying parameter|"
"returning object|throwing object|copying member subobject|copying array "
"element|allocating object|copying temporary|initializing base subobject|"
"initializing vector element|capturing value}0 of type %1">;
def ext_rvalue_to_reference_temp_copy_no_viable : Extension<
"no viable constructor %select{copying variable|copying parameter|"
"returning object|throwing object|copying member subobject|copying array "
"element|allocating object|copying temporary|initializing base subobject|"
"initializing vector element|capturing value}0 of type %1; C++98 requires a copy "
"constructor when binding a reference to a temporary">,
InGroup<BindToTemporaryCopy>;
def err_temp_copy_ambiguous : Error<
"ambiguous constructor call when %select{copying variable|copying "
"parameter|returning object|throwing object|copying member subobject|copying "
"array element|allocating object|copying temporary|initializing base subobject|"
"initializing vector element|capturing value}0 of type %1">;
def err_temp_copy_deleted : Error<
"%select{copying variable|copying parameter|returning object|throwing "
"object|copying member subobject|copying array element|allocating object|"
"copying temporary|initializing base subobject|initializing vector element|"
"capturing value}0 of type %1 invokes deleted constructor">;
def err_temp_copy_incomplete : Error<
"copying a temporary object of incomplete type %0">;
def warn_cxx98_compat_temp_copy : Warning<
"%select{copying variable|copying parameter|returning object|throwing "
"object|copying member subobject|copying array element|allocating object|"
"copying temporary|initializing base subobject|initializing vector element}1 "
"of type %2 when binding a reference to a temporary would %select{invoke "
"an inaccessible constructor|find no viable constructor|find ambiguous "
"constructors|invoke a deleted constructor}0 in C++98">,
InGroup<CXX98CompatBindToTemporaryCopy>, DefaultIgnore;
def err_selected_explicit_constructor : Error<
"chosen constructor is explicit in copy-initialization">;
def note_constructor_declared_here : Note<
"constructor declared here">;
// C++11 decltype
def err_decltype_in_declarator : Error<
"'decltype' cannot be used to name a declaration">;
// C++11 auto
def warn_cxx98_compat_auto_type_specifier : Warning<
"'auto' type specifier is incompatible with C++98">,
InGroup<CXX98Compat>, DefaultIgnore;
def err_auto_variable_cannot_appear_in_own_initializer : Error<
"variable %0 declared with 'auto' type cannot appear in its own initializer">;
def err_illegal_decl_array_of_auto : Error<
"'%0' declared as array of %1">;
def err_new_array_of_auto : Error<
"cannot allocate array of 'auto'">;
def err_auto_not_allowed : Error<
"%select{'auto'|'decltype(auto)'}0 not allowed %select{in function prototype"
"|in non-static struct member"
"|in non-static union member|in non-static class member|in interface member"
"|in exception declaration|in template parameter|in block literal"
"|in template argument|in typedef|in type alias|in function return type"
"|in conversion function type|here|in lambda parameter}1">;
def err_auto_not_allowed_var_inst : Error<
"'auto' variable template instantiation is not allowed">;
def err_auto_var_requires_init : Error<
"declaration of variable %0 with type %1 requires an initializer">;
def err_auto_new_requires_ctor_arg : Error<
"new expression for type %0 requires a constructor argument">;
def err_auto_new_list_init : Error<
"new expression for type %0 cannot use list-initialization">;
def err_auto_var_init_no_expression : Error<
"initializer for variable %0 with type %1 is empty">;
def err_auto_var_init_multiple_expressions : Error<
"initializer for variable %0 with type %1 contains multiple expressions">;
def err_auto_var_init_paren_braces : Error<
"cannot deduce type for variable %0 with type %1 from "
"parenthesized initializer list">;
def warn_auto_var_direct_list_init : Warning<
"direct list initialization of a variable with a deduced type will change "
"meaning in a future version of Clang; insert an '=' to avoid a change in "
"behavior">, InGroup<FutureCompat>;
def err_auto_new_ctor_multiple_expressions : Error<
"new expression for type %0 contains multiple constructor arguments">;
def err_auto_missing_trailing_return : Error<
"'auto' return without trailing return type; deduced return types are a "
"C++14 extension">;
def err_deduced_return_type : Error<
"deduced return types are a C++14 extension">;
def err_trailing_return_without_auto : Error<
"function with trailing return type must specify return type 'auto', not %0">;
def err_trailing_return_in_parens : Error<
"trailing return type may not be nested within parentheses">;
def err_auto_var_deduction_failure : Error<
"variable %0 with type %1 has incompatible initializer of type %2">;
def err_auto_var_deduction_failure_from_init_list : Error<
"cannot deduce actual type for variable %0 with type %1 from initializer list">;
def err_auto_new_deduction_failure : Error<
"new expression for type %0 has incompatible constructor argument of type %1">;
def err_auto_different_deductions : Error<
"'%select{auto|decltype(auto)}0' deduced as %1 in declaration of %2 and "
"deduced as %3 in declaration of %4">;
def err_implied_std_initializer_list_not_found : Error<
"cannot deduce type of initializer list because std::initializer_list was "
"not found; include <initializer_list>">;
def err_malformed_std_initializer_list : Error<
"std::initializer_list must be a class template with a single type parameter">;
def warn_dangling_std_initializer_list : Warning<
"array backing the initializer list will be destroyed at the end of "
"%select{the full-expression|the constructor}0">,
InGroup<DiagGroup<"dangling-initializer-list">>;
// C++1y decltype(auto) type
def err_decltype_auto_cannot_be_combined : Error<
"'decltype(auto)' cannot be combined with other type specifiers">;
def err_decltype_auto_function_declarator_not_declaration : Error<
"'decltype(auto)' can only be used as a return type "
"in a function declaration">;
def err_decltype_auto_compound_type : Error<
"cannot form %select{pointer to|reference to|array of}0 'decltype(auto)'">;
def err_decltype_auto_initializer_list : Error<
"cannot deduce 'decltype(auto)' from initializer list">;
// C++1y deduced return types
def err_auto_fn_deduction_failure : Error<
"cannot deduce return type %0 from returned value of type %1">;
def err_auto_fn_different_deductions : Error<
"'%select{auto|decltype(auto)}0' in return type deduced as %1 here but "
"deduced as %2 in earlier return statement">;
def err_auto_fn_used_before_defined : Error<
"function %0 with deduced return type cannot be used before it is defined">;
def err_auto_fn_no_return_but_not_auto : Error<
"cannot deduce return type %0 for function with no return statements">;
def err_auto_fn_return_void_but_not_auto : Error<
"cannot deduce return type %0 from omitted return expression">;
def err_auto_fn_return_init_list : Error<
"cannot deduce return type from initializer list">;
def err_auto_fn_virtual : Error<
"function with deduced return type cannot be virtual">;
// C++11 override control
def override_keyword_only_allowed_on_virtual_member_functions : Error<
"only virtual member functions can be marked '%0'">;
def override_keyword_hides_virtual_member_function : Error<
"non-virtual member function marked '%0' hides virtual member "
"%select{function|functions}1">;
def err_function_marked_override_not_overriding : Error<
"%0 marked 'override' but does not override any member functions">;
def warn_function_marked_not_override_overriding : Warning <
"%0 overrides a member function but is not marked 'override'">,
InGroup<CXX11WarnOverrideMethod>;
def err_class_marked_final_used_as_base : Error<
"base %0 is marked '%select{final|sealed}1'">;
def warn_abstract_final_class : Warning<
"abstract class is marked '%select{final|sealed}0'">, InGroup<AbstractFinalClass>;
// C++11 attributes
def err_repeat_attribute : Error<"%0 attribute cannot be repeated">;
// C++11 final
def err_final_function_overridden : Error<
"declaration of %0 overrides a '%select{final|sealed}1' function">;
// C++11 scoped enumerations
def err_enum_invalid_underlying : Error<
"non-integral type %0 is an invalid underlying type">;
def err_enumerator_too_large : Error<
"enumerator value is not representable in the underlying type %0">;
def ext_enumerator_too_large : ExtWarn<
"enumerator value is not representable in the underlying type %0">,
InGroup<Microsoft>;
def err_enumerator_wrapped : Error<
"enumerator value %0 is not representable in the underlying type %1">;
def err_enum_redeclare_type_mismatch : Error<
"enumeration redeclared with different underlying type %0 (was %1)">;
def err_enum_redeclare_fixed_mismatch : Error<
"enumeration previously declared with %select{non|}0fixed underlying type">;
def err_enum_redeclare_scoped_mismatch : Error<
"enumeration previously declared as %select{un|}0scoped">;
def err_enum_class_reference : Error<
"reference to %select{|scoped }0enumeration must use 'enum' "
"not 'enum class'">;
def err_only_enums_have_underlying_types : Error<
"only enumeration types have underlying types">;
def err_underlying_type_of_incomplete_enum : Error<
"cannot determine underlying type of incomplete enumeration type %0">;
// C++11 delegating constructors
def err_delegating_ctor : Error<
"delegating constructors are permitted only in C++11">;
def warn_cxx98_compat_delegating_ctor : Warning<
"delegating constructors are incompatible with C++98">,
InGroup<CXX98Compat>, DefaultIgnore;
def err_delegating_initializer_alone : Error<
"an initializer for a delegating constructor must appear alone">;
def warn_delegating_ctor_cycle : Warning<
"constructor for %0 creates a delegation cycle">, DefaultError,
InGroup<DelegatingCtorCycles>;
def note_it_delegates_to : Note<"it delegates to">;
def note_which_delegates_to : Note<"which delegates to">;
// C++11 range-based for loop
def err_for_range_decl_must_be_var : Error<
"for range declaration must declare a variable">;
def err_for_range_storage_class : Error<
"loop variable %0 may not be declared %select{'extern'|'static'|"
"'__private_extern__'|'auto'|'register'|'constexpr'}1">;
def err_type_defined_in_for_range : Error<
"types may not be defined in a for range declaration">;
def err_for_range_deduction_failure : Error<
"cannot use type %0 as a range">;
def err_for_range_incomplete_type : Error<
"cannot use incomplete type %0 as a range">;
def err_for_range_iter_deduction_failure : Error<
"cannot use type %0 as an iterator">;
def err_for_range_member_begin_end_mismatch : Error<
"range type %0 has '%select{begin|end}1' member but no '%select{end|begin}1' member">;
def err_for_range_begin_end_types_differ : Error<
"'begin' and 'end' must return the same type (got %0 and %1)">;
def note_in_for_range: Note<
"when looking up '%select{begin|end}0' function for range expression "
"of type %1">;
def err_for_range_invalid: Error<
"invalid range expression of type %0; no viable '%select{begin|end}1' "
"function available">;
def err_range_on_array_parameter : Error<
"cannot build range expression with array function parameter %0 since "
"parameter with array type %1 is treated as pointer type %2">;
def err_for_range_dereference : Error<
"invalid range expression of type %0; did you mean to dereference it "
"with '*'?">;
def note_for_range_invalid_iterator : Note <
"in implicit call to 'operator%select{!=|*|++}0' for iterator of type %1">;
def note_for_range_begin_end : Note<
"selected '%select{begin|end}0' %select{function|template }1%2 with iterator type %3">;
// C++11 constexpr
def warn_cxx98_compat_constexpr : Warning<
"'constexpr' specifier is incompatible with C++98">,
InGroup<CXX98Compat>, DefaultIgnore;
// FIXME: Maybe this should also go in -Wc++14-compat?
def warn_cxx14_compat_constexpr_not_const : Warning<
"'constexpr' non-static member function will not be implicitly 'const' "
"in C++14; add 'const' to avoid a change in behavior">,
InGroup<DiagGroup<"constexpr-not-const">>;
def err_invalid_constexpr : Error<
"%select{function parameter|typedef|non-static data member}0 "
"cannot be constexpr">;
def err_invalid_constexpr_member : Error<"non-static data member cannot be "
"constexpr%select{; did you intend to make it %select{const|static}0?|}1">;
def err_constexpr_tag : Error<
"%select{class|struct|interface|union|enum}0 cannot be marked constexpr">;
def err_constexpr_dtor : Error<"destructor cannot be marked constexpr">;
def err_constexpr_no_declarators : Error<
"constexpr can only be used in variable and function declarations">;
def err_invalid_constexpr_var_decl : Error<
"constexpr variable declaration must be a definition">;
def err_constexpr_static_mem_var_requires_init : Error<
"declaration of constexpr static data member %0 requires an initializer">;
def err_constexpr_var_non_literal : Error<
"constexpr variable cannot have non-literal type %0">;
def err_constexpr_var_requires_const_init : Error<
"constexpr variable %0 must be initialized by a constant expression">;
def err_constexpr_redecl_mismatch : Error<
"%select{non-constexpr declaration of %0 follows constexpr declaration"
"|constexpr declaration of %0 follows non-constexpr declaration}1">;
def err_constexpr_virtual : Error<"virtual function cannot be constexpr">;
def err_constexpr_virtual_base : Error<
"constexpr %select{member function|constructor}0 not allowed in "
"%select{struct|interface|class}1 with virtual base "
"%plural{1:class|:classes}2">;
def note_non_literal_incomplete : Note<
"incomplete type %0 is not a literal type">;
def note_non_literal_virtual_base : Note<"%select{struct|interface|class}0 "
"with virtual base %plural{1:class|:classes}1 is not a literal type">;
def note_constexpr_virtual_base_here : Note<"virtual base class declared here">;
def err_constexpr_non_literal_return : Error<
"constexpr function's return type %0 is not a literal type">;
def err_constexpr_non_literal_param : Error<
"constexpr %select{function|constructor}1's %ordinal0 parameter type %2 is "
"not a literal type">;
def err_constexpr_body_invalid_stmt : Error<
"statement not allowed in constexpr %select{function|constructor}0">;
def ext_constexpr_body_invalid_stmt : ExtWarn<
"use of this statement in a constexpr %select{function|constructor}0 "
"is a C++14 extension">, InGroup<CXX14>;
def warn_cxx11_compat_constexpr_body_invalid_stmt : Warning<
"use of this statement in a constexpr %select{function|constructor}0 "
"is incompatible with C++ standards before C++14">,
InGroup<CXXPre14Compat>, DefaultIgnore;
def ext_constexpr_type_definition : ExtWarn<
"type definition in a constexpr %select{function|constructor}0 "
"is a C++14 extension">, InGroup<CXX14>;
def warn_cxx11_compat_constexpr_type_definition : Warning<
"type definition in a constexpr %select{function|constructor}0 "
"is incompatible with C++ standards before C++14">,
InGroup<CXXPre14Compat>, DefaultIgnore;
def err_constexpr_vla : Error<
"variably-modified type %0 cannot be used in a constexpr "
"%select{function|constructor}1">;
def ext_constexpr_local_var : ExtWarn<
"variable declaration in a constexpr %select{function|constructor}0 "
"is a C++14 extension">, InGroup<CXX14>;
def warn_cxx11_compat_constexpr_local_var : Warning<
"variable declaration in a constexpr %select{function|constructor}0 "
"is incompatible with C++ standards before C++14">,
InGroup<CXXPre14Compat>, DefaultIgnore;
def err_constexpr_local_var_static : Error<
"%select{static|thread_local}1 variable not permitted in a constexpr "
"%select{function|constructor}0">;
def err_constexpr_local_var_non_literal_type : Error<
"variable of non-literal type %1 cannot be defined in a constexpr "
"%select{function|constructor}0">;
def err_constexpr_local_var_no_init : Error<
"variables defined in a constexpr %select{function|constructor}0 must be "
"initialized">;
def ext_constexpr_function_never_constant_expr : ExtWarn<
"constexpr %select{function|constructor}0 never produces a "
"constant expression">, InGroup<DiagGroup<"invalid-constexpr">>, DefaultError;
def err_enable_if_never_constant_expr : Error<
"'enable_if' attribute expression never produces a constant expression">;
def err_constexpr_body_no_return : Error<
"no return statement in constexpr function">;
def err_constexpr_return_missing_expr : Error<
"non-void constexpr function %0 should return a value">;
def warn_cxx11_compat_constexpr_body_no_return : Warning<
"constexpr function with no return statements is incompatible with C++ "
"standards before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
def ext_constexpr_body_multiple_return : ExtWarn<
"multiple return statements in constexpr function is a C++14 extension">,
InGroup<CXX14>;
def warn_cxx11_compat_constexpr_body_multiple_return : Warning<
"multiple return statements in constexpr function "
"is incompatible with C++ standards before C++14">,
InGroup<CXXPre14Compat>, DefaultIgnore;
def note_constexpr_body_previous_return : Note<
"previous return statement is here">;
def err_constexpr_function_try_block : Error<
"function try block not allowed in constexpr %select{function|constructor}0">;
def err_constexpr_union_ctor_no_init : Error<
"constexpr union constructor does not initialize any member">;
def err_constexpr_ctor_missing_init : Error<
"constexpr constructor must initialize all members">;
def note_constexpr_ctor_missing_init : Note<
"member not initialized by constructor">;
def note_non_literal_no_constexpr_ctors : Note<
"%0 is not literal because it is not an aggregate and has no constexpr "
"constructors other than copy or move constructors">;
def note_non_literal_base_class : Note<
"%0 is not literal because it has base class %1 of non-literal type">;
def note_non_literal_field : Note<
"%0 is not literal because it has data member %1 of "
"%select{non-literal|volatile}3 type %2">;
def note_non_literal_user_provided_dtor : Note<
"%0 is not literal because it has a user-provided destructor">;
def note_non_literal_nontrivial_dtor : Note<
"%0 is not literal because it has a non-trivial destructor">;
def warn_private_extern : Warning<
"use of __private_extern__ on a declaration may not produce external symbol "
"private to the linkage unit and is deprecated">, InGroup<PrivateExtern>;
def note_private_extern : Note<
"use __attribute__((visibility(\"hidden\"))) attribute instead">;
// C++11 char16_t/char32_t
def warn_cxx98_compat_unicode_type : Warning<
"'%0' type specifier is incompatible with C++98">,
InGroup<CXX98Compat>, DefaultIgnore;
// Objective-C++
def err_objc_decls_may_only_appear_in_global_scope : Error<
"Objective-C declarations may only appear in global scope">;
def warn_auto_var_is_id : Warning<
"'auto' deduced as 'id' in declaration of %0">,
InGroup<DiagGroup<"auto-var-id">>;
// Attributes
def err_nsobject_attribute : Error<
"'NSObject' attribute is for pointer types only">;
def err_attributes_are_not_compatible : Error<
"%0 and %1 attributes are not compatible">;
def err_attribute_wrong_number_arguments : Error<
"%0 attribute %plural{0:takes no arguments|1:takes one argument|"
":requires exactly %1 arguments}1">;
def err_attribute_too_many_arguments : Error<
"%0 attribute takes no more than %1 argument%s1">;
def err_attribute_too_few_arguments : Error<
"%0 attribute takes at least %1 argument%s1">;
def err_attribute_invalid_vector_type : Error<"invalid vector element type %0">;
def err_attribute_bad_neon_vector_size : Error<
"Neon vector size must be 64 or 128 bits">;
def err_attribute_unsupported : Error<
"%0 attribute is not supported for this target">;
// The err_*_attribute_argument_not_int are seperate because they're used by
// VerifyIntegerConstantExpression.
def err_aligned_attribute_argument_not_int : Error<
"'aligned' attribute requires integer constant">;
def err_align_value_attribute_argument_not_int : Error<
"'align_value' attribute requires integer constant">;
def err_alignas_attribute_wrong_decl_type : Error<
"%0 attribute cannot be applied to a %select{function parameter|"
"variable with 'register' storage class|'catch' variable|bit-field}1">;
def err_alignas_missing_on_definition : Error<
"%0 must be specified on definition if it is specified on any declaration">;
def note_alignas_on_declaration : Note<"declared with %0 attribute here">;
def err_alignas_mismatch : Error<
"redeclaration has different alignment requirement (%1 vs %0)">;
def err_alignas_underaligned : Error<
"requested alignment is less than minimum alignment of %1 for type %0">;
def err_attribute_argument_n_type : Error<
"%0 attribute requires parameter %1 to be %select{int or bool|an integer "
"constant|a string|an identifier}2">;
def err_attribute_argument_type : Error<
"%0 attribute requires %select{int or bool|an integer "
"constant|a string|an identifier}1">;
def err_attribute_argument_outof_range : Error<
"init_priority attribute requires integer constant between "
"101 and 65535 inclusive">;
def err_init_priority_object_attr : Error<
"can only use 'init_priority' attribute on file-scope definitions "
"of objects of class type">;
def err_attribute_argument_vec_type_hint : Error<
"invalid attribute argument %0 - expecting a vector or vectorizable scalar type">;
def err_attribute_argument_out_of_bounds : Error<
"%0 attribute parameter %1 is out of bounds">;
def err_attribute_uuid_malformed_guid : Error<
"uuid attribute contains a malformed GUID">;
def warn_attribute_pointers_only : Warning<
"%0 attribute only applies to pointer arguments">,
InGroup<IgnoredAttributes>;
def err_attribute_pointers_only : Error<warn_attribute_pointers_only.Text>;
def warn_attribute_return_pointers_only : Warning<
"%0 attribute only applies to return values that are pointers">,
InGroup<IgnoredAttributes>;
def warn_attribute_return_pointers_refs_only : Warning<
"%0 attribute only applies to return values that are pointers or references">,
InGroup<IgnoredAttributes>;
def warn_attribute_pointer_or_reference_only : Warning<
"%0 attribute only applies to a pointer or reference (%1 is invalid)">,
InGroup<IgnoredAttributes>;
def err_attribute_no_member_pointers : Error<
"%0 attribute cannot be used with pointers to members">;
def err_attribute_invalid_implicit_this_argument : Error<
"%0 attribute is invalid for the implicit this argument">;
def err_ownership_type : Error<
"%0 attribute only applies to %select{pointer|integer}1 arguments">;
def err_ownership_returns_index_mismatch : Error<
"'ownership_returns' attribute index does not match; here it is %0">;
def note_ownership_returns_index_mismatch : Note<
"declared with index %0 here">;
def err_format_strftime_third_parameter : Error<
"strftime format attribute requires 3rd parameter to be 0">;
def err_format_attribute_requires_variadic : Error<
"format attribute requires variadic function">;
def err_format_attribute_not : Error<"format argument not %0">;
def err_format_attribute_result_not : Error<"function does not return %0">;
def err_format_attribute_implicit_this_format_string : Error<
"format attribute cannot specify the implicit this argument as the format "
"string">;
def err_init_method_bad_return_type : Error<
"init methods must return an object pointer type, not %0">;
def err_attribute_invalid_size : Error<
"vector size not an integral multiple of component size">;
def err_attribute_zero_size : Error<"zero vector size">;
def err_attribute_size_too_large : Error<"vector size too large">;
def err_typecheck_vector_not_convertable : Error<
"can't convert between vector values of different size (%0 and %1)">;
def err_typecheck_vector_not_convertable_non_scalar : Error<
"can't convert between vector and non-scalar values (%0 and %1)">;
def err_typecheck_vector_lengths_not_equal : Error<
"vector operands do not have the same number of elements (%0 and %1)">;
def err_ext_vector_component_exceeds_length : Error<
"vector component access exceeds type %0">;
def err_ext_vector_component_name_illegal : Error<
"illegal vector component name '%0'">;
def err_attribute_address_space_negative : Error<
"address space is negative">;
def err_attribute_address_space_too_high : Error<
"address space is larger than the maximum supported (%0)">;
def err_attribute_address_multiple_qualifiers : Error<
"multiple address spaces specified for type">;
def err_attribute_address_function_type : Error<
"function type may not be qualified with an address space">;
def err_as_qualified_auto_decl : Error<
"automatic variable qualified with an address space">;
def err_arg_with_address_space : Error<
"parameter may not be qualified with an address space">;
def err_field_with_address_space : Error<
"field may not be qualified with an address space">;
def err_attr_objc_ownership_redundant : Error<
"the type %0 is already explicitly ownership-qualified">;
def err_undeclared_nsnumber : Error<
"NSNumber must be available to use Objective-C literals">;
def err_invalid_nsnumber_type : Error<
"%0 is not a valid literal type for NSNumber">;
def err_undeclared_nsstring : Error<
"cannot box a string value because NSString has not been declared">;
def err_objc_illegal_boxed_expression_type : Error<
"illegal type %0 used in a boxed expression">;
def err_objc_incomplete_boxed_expression_type : Error<
"incomplete type %0 used in a boxed expression">;
def err_undeclared_nsarray : Error<
"NSArray must be available to use Objective-C array literals">;
def err_undeclared_nsdictionary : Error<
"NSDictionary must be available to use Objective-C dictionary "
"literals">;
def err_undeclared_boxing_method : Error<
"declaration of %0 is missing in %1 class">;
def err_objc_literal_method_sig : Error<
"literal construction method %0 has incompatible signature">;
def note_objc_literal_method_param : Note<
"%select{first|second|third}0 parameter has unexpected type %1 "
"(should be %2)">;
def note_objc_literal_method_return : Note<
"method returns unexpected type %0 (should be an object type)">;
def err_invalid_collection_element : Error<
"collection element of type %0 is not an Objective-C object">;
def err_box_literal_collection : Error<
"%select{string|character|boolean|numeric}0 literal must be prefixed by '@' "
"in a collection">;
def warn_objc_literal_comparison : Warning<
"direct comparison of %select{an array literal|a dictionary literal|"
"a numeric literal|a boxed expression|}0 has undefined behavior">,
InGroup<ObjCLiteralComparison>;
def err_missing_atsign_prefix : Error<
"string literal must be prefixed by '@' ">;
def warn_objc_string_literal_comparison : Warning<
"direct comparison of a string literal has undefined behavior">,
InGroup<ObjCStringComparison>;
def warn_concatenated_nsarray_literal : Warning<
"concatenated NSString literal for an NSArray expression - "
"possibly missing a comma">,
InGroup<ObjCStringConcatenation>;
def note_objc_literal_comparison_isequal : Note<
"use 'isEqual:' instead">;
def err_attribute_argument_is_zero : Error<
"%0 attribute must be greater than 0">;
def err_property_function_in_objc_container : Error<
"use of Objective-C property in function nested in Objective-C "
"container not supported, move function outside its container">;
let CategoryName = "Cocoa API Issue" in {
def warn_objc_redundant_literal_use : Warning<
"using %0 with a literal is redundant">, InGroup<ObjCRedundantLiteralUse>;
}
def err_attr_tlsmodel_arg : Error<"tls_model must be \"global-dynamic\", "
"\"local-dynamic\", \"initial-exec\" or \"local-exec\"">;
def err_only_annotate_after_access_spec : Error<
"access specifier can only have annotation attributes">;
def err_attribute_section_invalid_for_target : Error<
"argument to 'section' attribute is not valid for this target: %0">;
def warn_mismatched_section : Warning<
"section does not match previous declaration">, InGroup<Section>;
def err_anonymous_property: Error<
"anonymous property is not supported">;
def err_property_is_variably_modified : Error<
"property %0 has a variably modified type">;
def err_no_accessor_for_property : Error<
"no %select{getter|setter}0 defined for property %1">;
def error_cannot_find_suitable_accessor : Error<
"cannot find suitable %select{getter|setter}0 for property %1">;
def err_alignment_not_power_of_two : Error<
"requested alignment is not a power of 2">;
def err_alignment_dependent_typedef_name : Error<
"requested alignment is dependent but declaration is not dependent">;
def err_attribute_aligned_too_great : Error<
"requested alignment must be %0 bytes or smaller">;
def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning<
"%q0 redeclared without %1 attribute: previous %1 ignored">,
InGroup<DiagGroup<"inconsistent-dllimport">>;
def warn_dllimport_dropped_from_inline_function : Warning<
"%q0 redeclared inline; %1 attribute ignored">,
InGroup<IgnoredAttributes>;
def warn_attribute_ignored : Warning<"%0 attribute ignored">,
InGroup<IgnoredAttributes>;
def warn_attribute_ignored_on_inline :
Warning<"%0 attribute ignored on inline function">,
InGroup<IgnoredAttributes>;
def warn_attribute_after_definition_ignored : Warning<
"attribute %0 after definition is ignored">,
InGroup<IgnoredAttributes>;
def warn_unknown_attribute_ignored : Warning<
"unknown attribute %0 ignored">, InGroup<UnknownAttributes>;
def warn_cxx11_gnu_attribute_on_type : Warning<
"attribute %0 ignored, because it cannot be applied to a type">,
InGroup<IgnoredAttributes>;
def warn_unhandled_ms_attribute_ignored : Warning<
"__declspec attribute %0 is not supported">,
InGroup<IgnoredAttributes>;
def err_attribute_invalid_on_stmt : Error<
"%0 attribute cannot be applied to a statement">;
def warn_declspec_attribute_ignored : Warning<
"attribute %0 is ignored, place it after "
"\"%select{class|struct|union|interface|enum}1\" to apply attribute to "
"type declaration">, InGroup<IgnoredAttributes>;
def warn_attribute_precede_definition : Warning<
"attribute declaration must precede definition">,
InGroup<IgnoredAttributes>;
def warn_attribute_void_function_method : Warning<
"attribute %0 cannot be applied to "
"%select{functions|Objective-C method}1 without return value">,
InGroup<IgnoredAttributes>;
def warn_attribute_weak_on_field : Warning<
"__weak attribute cannot be specified on a field declaration">,
InGroup<IgnoredAttributes>;
def warn_gc_attribute_weak_on_local : Warning<
"Objective-C GC does not allow weak variables on the stack">,
InGroup<IgnoredAttributes>;
def warn_nsobject_attribute : Warning<
"'NSObject' attribute may be put on a typedef only; attribute is ignored">,
InGroup<NSobjectAttribute>;
def warn_attribute_weak_on_local : Warning<
"__weak attribute cannot be specified on an automatic variable when ARC "
"is not enabled">,
InGroup<IgnoredAttributes>;
def warn_weak_identifier_undeclared : Warning<
"weak identifier %0 never declared">;
def err_attribute_weak_static : Error<
"weak declaration cannot have internal linkage">;
def err_attribute_selectany_non_extern_data : Error<
"'selectany' can only be applied to data items with external linkage">;
def err_declspec_thread_on_thread_variable : Error<
"'__declspec(thread)' applied to variable that already has a "
"thread-local storage specifier">;
def err_attribute_dll_not_extern : Error<
"%q0 must have external linkage when declared %q1">;
def err_attribute_dll_thread_local : Error<
"%q0 cannot be thread local when declared %q1">;
def warn_attribute_invalid_on_definition : Warning<
"'%0' attribute cannot be specified on a definition">,
InGroup<IgnoredAttributes>;
def err_attribute_dll_redeclaration : Error<
"redeclaration of %q0 cannot add %q1 attribute">;
def warn_attribute_dll_redeclaration : Warning<
"redeclaration of %q0 should not add %q1 attribute">,
InGroup<DiagGroup<"dll-attribute-on-redeclaration">>;
def err_attribute_dllimport_function_definition : Error<
"dllimport cannot be applied to non-inline function definition">;
def err_attribute_dll_deleted : Error<
"attribute %q0 cannot be applied to a deleted function">;
def err_attribute_dllimport_data_definition : Error<
"definition of dllimport data">;
def err_attribute_dllimport_static_field_definition : Error<
"definition of dllimport static field not allowed">;
def warn_attribute_dllimport_static_field_definition : Warning<
"definition of dllimport static field">,
InGroup<DiagGroup<"dllimport-static-field-def">>;
def warn_attribute_dllexport_explicit_instantiation_decl : Warning<
"explicit instantiation declaration should not be 'dllexport'">,
InGroup<DiagGroup<"dllexport-explicit-instantation-decl">>;
def warn_invalid_initializer_from_system_header : Warning<
"invalid constructor form class in system header, should not be explicit">,
InGroup<DiagGroup<"invalid-initializer-from-system-header">>;
def note_used_in_initialization_here : Note<"used in initialization here">;
def err_attribute_dll_member_of_dll_class : Error<
"attribute %q0 cannot be applied to member of %q1 class">;
def warn_attribute_dll_instantiated_base_class : Warning<
"propagating dll attribute to %select{already instantiated|explicitly specialized}0 "
"base class template "
"%select{without dll attribute|with different dll attribute}1 is not supported">,
InGroup<DiagGroup<"unsupported-dll-base-class-template">>, DefaultIgnore;
def err_attribute_weakref_not_static : Error<
"weakref declaration must have internal linkage">;
def err_attribute_weakref_not_global_context : Error<
"weakref declaration of %0 must be in a global context">;
def err_attribute_weakref_without_alias : Error<
"weakref declaration of %0 must also have an alias attribute">;
def err_alias_not_supported_on_darwin : Error <
"only weak aliases are supported on darwin">;
def err_alias_to_undefined : Error<
"alias must point to a defined variable or function">;
def warn_alias_to_weak_alias : Warning<
"alias will always resolve to %0 even if weak definition of alias %1 is overridden">,
InGroup<IgnoredAttributes>;
def warn_alias_with_section : Warning<
"alias will not be in section '%0' but in the same section as the aliasee">,
InGroup<IgnoredAttributes>;
def err_duplicate_mangled_name : Error<
"definition with same mangled name as another definition">;
def err_cyclic_alias : Error<
"alias definition is part of a cycle">;
def warn_attribute_wrong_decl_type : Warning<
"%0 attribute only applies to %select{functions|unions|"
"variables and functions|functions and methods|parameters|"
"functions, methods and blocks|functions, methods, and classes|"
"functions, methods, and parameters|classes|enums|variables|methods|"
"variables, functions and labels|fields and global variables|structs|"
"variables and typedefs|thread-local variables|"
"variables and fields|variables, data members and tag types|"
"types and namespaces|Objective-C interfaces|methods and properties|"
"struct or union|struct, union or class|types|"
"Objective-C instance methods|init methods of interface or class extension declarations|"
"variables, functions and classes|Objective-C protocols|"
"functions and global variables|structs, unions, and typedefs|structs and typedefs|"
"interface or protocol declarations|kernel functions}1">,
InGroup<IgnoredAttributes>;
def err_attribute_wrong_decl_type : Error<warn_attribute_wrong_decl_type.Text>;
def warn_type_attribute_wrong_type : Warning<
"'%0' only applies to %select{function|pointer|"
"Objective-C object or block pointer}1 types; type here is %2">,
InGroup<IgnoredAttributes>;
def warn_incomplete_encoded_type : Warning<
"encoding of %0 type is incomplete because %1 component has unknown encoding">,
InGroup<DiagGroup<"encode-type">>;
def warn_attribute_requires_functions_or_static_globals : Warning<
"%0 only applies to variables with static storage duration and functions">,
InGroup<IgnoredAttributes>;
def warn_gnu_inline_attribute_requires_inline : Warning<
"'gnu_inline' attribute requires function to be marked 'inline',"
" attribute ignored">,
InGroup<IgnoredAttributes>;
def err_attribute_vecreturn_only_vector_member : Error<
"the vecreturn attribute can only be used on a class or structure with one member, which must be a vector">;
def err_attribute_vecreturn_only_pod_record : Error<
"the vecreturn attribute can only be used on a POD (plain old data) class or structure (i.e. no virtual functions)">;
def err_cconv_change : Error<
"function declared '%0' here was previously declared "
"%select{'%2'|without calling convention}1">;
def warn_cconv_ignored : Warning<
"calling convention %0 ignored for this target">, InGroup<IgnoredAttributes>;
def err_cconv_knr : Error<
"function with no prototype cannot use the %0 calling convention">;
def warn_cconv_knr : Warning<
err_cconv_knr.Text>,
InGroup<DiagGroup<"missing-prototype-for-cc">>;
def err_cconv_varargs : Error<
"variadic function cannot use %0 calling convention">;
def warn_cconv_varargs : Warning<
"%0 calling convention ignored on variadic function">,
InGroup<IgnoredAttributes>;
def err_regparm_mismatch : Error<"function declared with regparm(%0) "
"attribute was previously declared "
"%plural{0:without the regparm|:with the regparm(%1)}1 attribute">;
def err_returns_retained_mismatch : Error<
"function declared with the ns_returns_retained attribute "
"was previously declared without the ns_returns_retained attribute">;
def err_objc_precise_lifetime_bad_type : Error<
"objc_precise_lifetime only applies to retainable types; type here is %0">;
def warn_objc_precise_lifetime_meaningless : Error<
"objc_precise_lifetime is not meaningful for "
"%select{__unsafe_unretained|__autoreleasing}0 objects">;
def err_invalid_pcs : Error<"invalid PCS type">;
def warn_attribute_not_on_decl : Warning<
"%0 attribute ignored when parsing type">, InGroup<IgnoredAttributes>;
def err_base_specifier_attribute : Error<
"%0 attribute cannot be applied to a base specifier">;
// Availability attribute
def warn_availability_unknown_platform : Warning<
"unknown platform %0 in availability macro">, InGroup<Availability>;
def warn_availability_version_ordering : Warning<
"feature cannot be %select{introduced|deprecated|obsoleted}0 in %1 version "
"%2 before it was %select{introduced|deprecated|obsoleted}3 in version %4; "
"attribute ignored">, InGroup<Availability>;
def warn_mismatched_availability: Warning<
"availability does not match previous declaration">, InGroup<Availability>;
def warn_mismatched_availability_override : Warning<
"overriding method %select{introduced after|"
"deprecated before|obsoleted before}0 overridden method on %1 (%2 vs. %3)">,
InGroup<Availability>;
def warn_mismatched_availability_override_unavail : Warning<
"overriding method cannot be unavailable on %0 when its overridden method is "
"available">,
InGroup<Availability>;
def note_overridden_method : Note<
"overridden method is here">;
// Thread Safety Attributes
def warn_invalid_capability_name : Warning<
"invalid capability name '%0'; capability name must be 'mutex' or 'role'">,
InGroup<ThreadSafetyAttributes>, DefaultIgnore;
def warn_thread_attribute_ignored : Warning<
"ignoring %0 attribute because its argument is invalid">,
InGroup<ThreadSafetyAttributes>, DefaultIgnore;
def warn_thread_attribute_argument_not_lockable : Warning<
"%0 attribute requires arguments whose type is annotated "
"with 'capability' attribute; type here is %1">,
InGroup<ThreadSafetyAttributes>, DefaultIgnore;
def warn_thread_attribute_decl_not_lockable : Warning<
"%0 attribute can only be applied in a context annotated "
"with 'capability(\"mutex\")' attribute">,
InGroup<ThreadSafetyAttributes>, DefaultIgnore;
def warn_thread_attribute_decl_not_pointer : Warning<
"%0 only applies to pointer types; type here is %1">,
InGroup<ThreadSafetyAttributes>, DefaultIgnore;
def err_attribute_argument_out_of_range : Error<
"%0 attribute parameter %1 is out of bounds: "
"%plural{0:no parameters to index into|"
"1:can only be 1, since there is one parameter|"
":must be between 1 and %2}2">;
// Thread Safety Analysis
def warn_unlock_but_no_lock : Warning<"releasing %0 '%1' that was not held">,
InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
def warn_unlock_kind_mismatch : Warning<
"releasing %0 '%1' using %select{shared|exclusive}2 access, expected "
"%select{shared|exclusive}3 access">,
InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
def warn_double_lock : Warning<"acquiring %0 '%1' that is already held">,
InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
def warn_no_unlock : Warning<
"%0 '%1' is still held at the end of function">,
InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
def warn_expecting_locked : Warning<
"expecting %0 '%1' to be held at the end of function">,
InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
// FIXME: improve the error message about locks not in scope
def warn_lock_some_predecessors : Warning<
"%0 '%1' is not held on every path through here">,
InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
def warn_expecting_lock_held_on_loop : Warning<
"expecting %0 '%1' to be held at start of each loop">,
InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
def note_locked_here : Note<"%0 acquired here">;
def warn_lock_exclusive_and_shared : Warning<
"%0 '%1' is acquired exclusively and shared in the same scope">,
InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
def note_lock_exclusive_and_shared : Note<
"the other acquisition of %0 '%1' is here">;
def warn_variable_requires_any_lock : Warning<
"%select{reading|writing}1 variable '%0' requires holding "
"%select{any mutex|any mutex exclusively}1">,
InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
def warn_var_deref_requires_any_lock : Warning<
"%select{reading|writing}1 the value pointed to by '%0' requires holding "
"%select{any mutex|any mutex exclusively}1">,
InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
def warn_fun_excludes_mutex : Warning<
"cannot call function '%1' while %0 '%2' is held">,
InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
def warn_cannot_resolve_lock : Warning<
"cannot resolve lock expression">,
InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
def warn_acquired_before : Warning<
"%0 '%1' must be acquired before '%2'">,
InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
def warn_acquired_before_after_cycle : Warning<
"Cycle in acquired_before/after dependencies, starting with '%0'">,
InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
// Thread safety warnings negative capabilities
def warn_acquire_requires_negative_cap : Warning<
"acquiring %0 '%1' requires negative capability '%2'">,
InGroup<ThreadSafetyNegative>, DefaultIgnore;
// Thread safety warnings on pass by reference
def warn_guarded_pass_by_reference : Warning<
"passing variable '%1' by reference requires holding %0 "
"%select{'%2'|'%2' exclusively}3">,
InGroup<ThreadSafetyReference>, DefaultIgnore;
def warn_pt_guarded_pass_by_reference : Warning<
"passing the value that '%1' points to by reference requires holding %0 "
"%select{'%2'|'%2' exclusively}3">,
InGroup<ThreadSafetyReference>, DefaultIgnore;
// Imprecise thread safety warnings
def warn_variable_requires_lock : Warning<
"%select{reading|writing}3 variable '%1' requires holding %0 "
"%select{'%2'|'%2' exclusively}3">,
InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
def warn_var_deref_requires_lock : Warning<
"%select{reading|writing}3 the value pointed to by '%1' requires "
"holding %0 %select{'%2'|'%2' exclusively}3">,
InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
def warn_fun_requires_lock : Warning<
"calling function '%1' requires holding %0 %select{'%2'|'%2' exclusively}3">,
InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
// Precise thread safety warnings
def warn_variable_requires_lock_precise :
Warning<warn_variable_requires_lock.Text>,
InGroup<ThreadSafetyPrecise>, DefaultIgnore;
def warn_var_deref_requires_lock_precise :
Warning<warn_var_deref_requires_lock.Text>,
InGroup<ThreadSafetyPrecise>, DefaultIgnore;
def warn_fun_requires_lock_precise :
Warning<warn_fun_requires_lock.Text>,
InGroup<ThreadSafetyPrecise>, DefaultIgnore;
def note_found_mutex_near_match : Note<"found near match '%0'">;
// Verbose thread safety warnings
def warn_thread_safety_verbose : Warning<"Thread safety verbose warning.">,
InGroup<ThreadSafetyVerbose>, DefaultIgnore;
def note_thread_warning_in_fun : Note<"Thread warning in function '%0'">;
def note_guarded_by_declared_here : Note<"Guarded_by declared here.">;
// Dummy warning that will trigger "beta" warnings from the analysis if enabled.
def warn_thread_safety_beta : Warning<"Thread safety beta warning.">,
InGroup<ThreadSafetyBeta>, DefaultIgnore;
// Consumed warnings
def warn_use_in_invalid_state : Warning<
"invalid invocation of method '%0' on object '%1' while it is in the '%2' "
"state">, InGroup<Consumed>, DefaultIgnore;
def warn_use_of_temp_in_invalid_state : Warning<
"invalid invocation of method '%0' on a temporary object while it is in the "
"'%1' state">, InGroup<Consumed>, DefaultIgnore;
def warn_attr_on_unconsumable_class : Warning<
"consumed analysis attribute is attached to member of class '%0' which isn't "
"marked as consumable">, InGroup<Consumed>, DefaultIgnore;
def warn_return_typestate_for_unconsumable_type : Warning<
"return state set for an unconsumable type '%0'">, InGroup<Consumed>,
DefaultIgnore;
def warn_return_typestate_mismatch : Warning<
"return value not in expected state; expected '%0', observed '%1'">,
InGroup<Consumed>, DefaultIgnore;
def warn_loop_state_mismatch : Warning<
"state of variable '%0' must match at the entry and exit of loop">,
InGroup<Consumed>, DefaultIgnore;
def warn_param_return_typestate_mismatch : Warning<
"parameter '%0' not in expected state when the function returns: expected "
"'%1', observed '%2'">, InGroup<Consumed>, DefaultIgnore;
def warn_param_typestate_mismatch : Warning<
"argument not in expected state; expected '%0', observed '%1'">,
InGroup<Consumed>, DefaultIgnore;
def warn_impcast_vector_scalar : Warning<
"implicit conversion turns vector to scalar: %0 to %1">,
InGroup<Conversion>, DefaultIgnore;
def warn_impcast_complex_scalar : Warning<
"implicit conversion discards imaginary component: %0 to %1">,
InGroup<Conversion>, DefaultIgnore;
def warn_impcast_float_precision : Warning<
"implicit conversion loses floating-point precision: %0 to %1">,
InGroup<Conversion>, DefaultIgnore;
def warn_impcast_float_integer : Warning<
"implicit conversion turns floating-point number into integer: %0 to %1">,
InGroup<FloatConversion>, DefaultIgnore;
def warn_impcast_integer_sign : Warning<
"implicit conversion changes signedness: %0 to %1">,
InGroup<SignConversion>, DefaultIgnore;
def warn_impcast_integer_sign_conditional : Warning<
"operand of ? changes signedness: %0 to %1">,
InGroup<SignConversion>, DefaultIgnore;
def warn_impcast_integer_precision : Warning<
"implicit conversion loses integer precision: %0 to %1">,
InGroup<Conversion>, DefaultIgnore;
def warn_impcast_integer_64_32 : Warning<
"implicit conversion loses integer precision: %0 to %1">,
InGroup<Shorten64To32>, DefaultIgnore;
def warn_impcast_integer_precision_constant : Warning<
"implicit conversion from %2 to %3 changes value from %0 to %1">,
InGroup<ConstantConversion>;
def warn_impcast_bitfield_precision_constant : Warning<
"implicit truncation from %2 to bitfield changes value from %0 to %1">,
InGroup<BitFieldConstantConversion>;
def warn_impcast_literal_float_to_integer : Warning<
"implicit conversion from %0 to %1 changes value from %2 to %3">,
InGroup<LiteralConversion>;
def warn_impcast_string_literal_to_bool : Warning<
"implicit conversion turns string literal into bool: %0 to %1">,
InGroup<StringConversion>, DefaultIgnore;
def warn_impcast_different_enum_types : Warning<
"implicit conversion from enumeration type %0 to different enumeration type "
"%1">, InGroup<EnumConversion>;
def warn_impcast_bool_to_null_pointer : Warning<
"initialization of pointer of type %0 to null from a constant boolean "
"expression">, InGroup<BoolConversion>;
def warn_non_literal_null_pointer : Warning<
"expression which evaluates to zero treated as a null pointer constant of "
"type %0">, InGroup<NonLiteralNullConversion>;
def warn_impcast_null_pointer_to_integer : Warning<
"implicit conversion of %select{NULL|nullptr}0 constant to %1">,
InGroup<NullConversion>;
def warn_impcast_floating_point_to_bool : Warning<
"implicit conversion turns floating-point number into bool: %0 to %1">,
InGroup<ImplicitConversionFloatingPointToBool>;
def warn_impcast_pointer_to_bool : Warning<
"address of%select{| function| array}0 '%1' will always evaluate to "
"'true'">,
InGroup<PointerBoolConversion>;
def warn_cast_nonnull_to_bool : Warning<
"nonnull parameter '%0' will evaluate to "
"'true' on first encounter">,
InGroup<PointerBoolConversion>;
def warn_this_bool_conversion : Warning<
"'this' pointer cannot be null in well-defined C++ code; pointer may be "
"assumed to always convert to true">, InGroup<UndefinedBoolConversion>;
def warn_address_of_reference_bool_conversion : Warning<
"reference cannot be bound to dereferenced null pointer in well-defined C++ "
"code; pointer may be assumed to always convert to true">,
InGroup<UndefinedBoolConversion>;
def warn_null_pointer_compare : Warning<
"comparison of %select{address of|function|array}0 '%1' %select{not |}2"
"equal to a null pointer is always %select{true|false}2">,
InGroup<TautologicalPointerCompare>;
def warn_nonnull_parameter_compare : Warning<
"comparison of nonnull parameter '%0' %select{not |}1"
"equal to a null pointer is %select{true|false}1 on first encounter">,
InGroup<TautologicalPointerCompare>;
def warn_this_null_compare : Warning<
"'this' pointer cannot be null in well-defined C++ code; comparison may be "
"assumed to always evaluate to %select{true|false}0">,
InGroup<TautologicalUndefinedCompare>;
def warn_address_of_reference_null_compare : Warning<
"reference cannot be bound to dereferenced null pointer in well-defined C++ "
"code; comparison may be assumed to always evaluate to "
"%select{true|false}0">,
InGroup<TautologicalUndefinedCompare>;
def note_reference_is_return_value : Note<"%0 returns a reference">;
def note_function_warning_silence : Note<
"prefix with the address-of operator to silence this warning">;
def note_function_to_function_call : Note<
"suffix with parentheses to turn this into a function call">;
def warn_impcast_objective_c_literal_to_bool : Warning<
"implicit boolean conversion of Objective-C object literal always "
"evaluates to true">,
InGroup<ObjCLiteralConversion>;
def warn_cast_align : Warning<
"cast from %0 to %1 increases required alignment from %2 to %3">,
InGroup<CastAlign>, DefaultIgnore;
def warn_old_style_cast : Warning<
"use of old-style cast">, InGroup<OldStyleCast>, DefaultIgnore;
// Separate between casts to void* and non-void* pointers.
// Some APIs use (abuse) void* for something like a user context,
// and often that value is an integer even if it isn't a pointer itself.
// Having a separate warning flag allows users to control the warning
// for their workflow.
def warn_int_to_pointer_cast : Warning<
"cast to %1 from smaller integer type %0">,
InGroup<IntToPointerCast>;
def warn_int_to_void_pointer_cast : Warning<
"cast to %1 from smaller integer type %0">,
InGroup<IntToVoidPointerCast>;
def warn_attribute_ignored_for_field_of_type : Warning<
"%0 attribute ignored for field of type %1">,
InGroup<IgnoredAttributes>;
def warn_transparent_union_attribute_field_size_align : Warning<
"%select{alignment|size}0 of field %1 (%2 bits) does not match the "
"%select{alignment|size}0 of the first field in transparent union; "
"transparent_union attribute ignored">,
InGroup<IgnoredAttributes>;
def note_transparent_union_first_field_size_align : Note<
"%select{alignment|size}0 of first field is %1 bits">;
def warn_transparent_union_attribute_not_definition : Warning<
"transparent_union attribute can only be applied to a union definition; "
"attribute ignored">,
InGroup<IgnoredAttributes>;
def warn_transparent_union_attribute_floating : Warning<
"first field of a transparent union cannot have %select{floating point|"
"vector}0 type %1; transparent_union attribute ignored">,
InGroup<IgnoredAttributes>;
def warn_transparent_union_attribute_zero_fields : Warning<
"transparent union definition must contain at least one field; "
"transparent_union attribute ignored">,
InGroup<IgnoredAttributes>;
def warn_attribute_type_not_supported : Warning<
"%0 attribute argument not supported: %1">,
InGroup<IgnoredAttributes>;
def warn_attribute_unknown_visibility : Warning<"unknown visibility %0">,
InGroup<IgnoredAttributes>;
def warn_attribute_protected_visibility :
Warning<"target does not support 'protected' visibility; using 'default'">,
InGroup<DiagGroup<"unsupported-visibility">>;
def err_mismatched_visibility: Error<"visibility does not match previous declaration">;
def note_previous_attribute : Note<"previous attribute is here">;
def note_conflicting_attribute : Note<"conflicting attribute is here">;
def note_attribute : Note<"attribute is here">;
def err_mismatched_ms_inheritance : Error<
"inheritance model does not match %select{definition|previous declaration}0">;
def warn_ignored_ms_inheritance : Warning<
"inheritance model ignored on %select{primary template|partial specialization}0">,
InGroup<IgnoredAttributes>;
def note_previous_ms_inheritance : Note<
"previous inheritance model specified here">;
def err_machine_mode : Error<"%select{unknown|unsupported}0 machine mode %1">;
def err_mode_not_primitive : Error<
"mode attribute only supported for integer and floating-point types">;
def err_mode_wrong_type : Error<
"type of machine mode does not match type of base type">;
def err_attr_wrong_decl : Error<
"%0 attribute invalid on this declaration, requires typedef or value">;
def warn_attribute_nonnull_no_pointers : Warning<
"'nonnull' attribute applied to function with no pointer arguments">,
InGroup<IgnoredAttributes>;
def warn_attribute_nonnull_parm_no_args : Warning<
"'nonnull' attribute when used on parameters takes no arguments">,
InGroup<IgnoredAttributes>;
def warn_attribute_sentinel_named_arguments : Warning<
"'sentinel' attribute requires named arguments">,
InGroup<IgnoredAttributes>;
def warn_attribute_sentinel_not_variadic : Warning<
"'sentinel' attribute only supported for variadic %select{functions|blocks}0">,
InGroup<IgnoredAttributes>;
def err_attribute_sentinel_less_than_zero : Error<
"'sentinel' parameter 1 less than zero">;
def err_attribute_sentinel_not_zero_or_one : Error<
"'sentinel' parameter 2 not 0 or 1">;
def warn_cleanup_ext : Warning<
"GCC does not allow the 'cleanup' attribute argument to be anything other "
"than a simple identifier">,
InGroup<GccCompat>;
def err_attribute_cleanup_arg_not_function : Error<
"'cleanup' argument %select{|%1 |%1 }0is not a %select{||single }0function">;
def err_attribute_cleanup_func_must_take_one_arg : Error<
"'cleanup' function %0 must take 1 parameter">;
def err_attribute_cleanup_func_arg_incompatible_type : Error<
"'cleanup' function %0 parameter has "
"%diff{type $ which is incompatible with type $|incompatible type}1,2">;
def err_attribute_regparm_wrong_platform : Error<
"'regparm' is not valid on this platform">;
def err_attribute_regparm_invalid_number : Error<
"'regparm' parameter must be between 0 and %0 inclusive">;
def err_attribute_not_supported_in_lang : Error<
"%0 attribute is not supported in %select{C|C++|Objective-C}1">;
// Clang-Specific Attributes
def warn_attribute_iboutlet : Warning<
"%0 attribute can only be applied to instance variables or properties">,
InGroup<IgnoredAttributes>;
def err_iboutletcollection_type : Error<
"invalid type %0 as argument of iboutletcollection attribute">;
def err_iboutletcollection_builtintype : Error<
"type argument of iboutletcollection attribute cannot be a builtin type">;
def warn_iboutlet_object_type : Warning<
"%select{instance variable|property}2 with %0 attribute must "
"be an object type (invalid %1)">, InGroup<ObjCInvalidIBOutletProperty>;
def warn_iboutletcollection_property_assign : Warning<
"IBOutletCollection properties should be copy/strong and not assign">,
InGroup<ObjCInvalidIBOutletProperty>;
def err_attribute_overloadable_missing : Error<
"%select{overloaded function|redeclaration of}0 %1 must have the "
"'overloadable' attribute">;
def note_attribute_overloadable_prev_overload : Note<
"previous overload of function is here">;
def err_attribute_overloadable_no_prototype : Error<
"'overloadable' function %0 must have a prototype">;
def warn_ns_attribute_wrong_return_type : Warning<
"%0 attribute only applies to %select{functions|methods|properties}1 that "
"return %select{an Objective-C object|a pointer|a non-retainable pointer}2">,
InGroup<IgnoredAttributes>;
def warn_ns_attribute_wrong_parameter_type : Warning<
"%0 attribute only applies to %select{Objective-C object|pointer}1 "
"parameters">,
InGroup<IgnoredAttributes>;
def warn_objc_requires_super_protocol : Warning<
"%0 attribute cannot be applied to %select{methods in protocols|dealloc}1">,
InGroup<DiagGroup<"requires-super-attribute">>;
def note_protocol_decl : Note<
"protocol is declared here">;
def note_protocol_decl_undefined : Note<
"protocol %0 has no definition">;
// objc_designated_initializer attribute diagnostics.
def warn_objc_designated_init_missing_super_call : Warning<
"designated initializer missing a 'super' call to a designated initializer of the super class">,
InGroup<ObjCDesignatedInit>;
def note_objc_designated_init_marked_here : Note<
"method marked as designated initializer of the class here">;
def warn_objc_designated_init_non_super_designated_init_call : Warning<
"designated initializer should only invoke a designated initializer on 'super'">,
InGroup<ObjCDesignatedInit>;
def warn_objc_designated_init_non_designated_init_call : Warning<
"designated initializer invoked a non-designated initializer">,
InGroup<ObjCDesignatedInit>;
def warn_objc_secondary_init_super_init_call : Warning<
"convenience initializer should not invoke an initializer on 'super'">,
InGroup<ObjCDesignatedInit>;
def warn_objc_secondary_init_missing_init_call : Warning<
"convenience initializer missing a 'self' call to another initializer">,
InGroup<ObjCDesignatedInit>;
def warn_objc_implementation_missing_designated_init_override : Warning<
"method override for the designated initializer of the superclass %objcinstance0 not found">,
InGroup<ObjCDesignatedInit>;
// objc_bridge attribute diagnostics.
def err_objc_attr_not_id : Error<
"parameter of %0 attribute must be a single name of an Objective-C %select{class|protocol}1">;
def err_objc_attr_typedef_not_id : Error<
"parameter of %0 attribute must be 'id' when used on a typedef">;
def err_objc_attr_typedef_not_void_pointer : Error<
"'objc_bridge(id)' is only allowed on structs and typedefs of void pointers">;
def err_objc_cf_bridged_not_interface : Error<
"CF object of type %0 is bridged to %1, which is not an Objective-C class">;
def err_objc_ns_bridged_invalid_cfobject : Error<
"ObjectiveC object of type %0 is bridged to %1, which is not valid CF object">;
def warn_objc_invalid_bridge : Warning<
"%0 bridges to %1, not %2">, InGroup<ObjCBridge>;
def warn_objc_invalid_bridge_to_cf : Warning<
"%0 cannot bridge to %1">, InGroup<ObjCBridge>;
// objc_bridge_related attribute diagnostics.
def err_objc_bridged_related_invalid_class : Error<
"could not find Objective-C class %0 to convert %1 to %2">;
def err_objc_bridged_related_invalid_class_name : Error<
"%0 must be name of an Objective-C class to be able to convert %1 to %2">;
def err_objc_bridged_related_known_method : Error<
"%0 must be explicitly converted to %1; use %select{%objcclass2|%objcinstance2}3 "
"method for this conversion">;
def err_objc_attr_protocol_requires_definition : Error<
"attribute %0 can only be applied to @protocol definitions, not forward declarations">;
// Function Parameter Semantic Analysis.
def err_param_with_void_type : Error<"argument may not have 'void' type">;
def err_void_only_param : Error<
"'void' must be the first and only parameter if specified">;
def err_void_param_qualified : Error<
"'void' as parameter must not have type qualifiers">;
def err_ident_list_in_fn_declaration : Error<
"a parameter list without types is only allowed in a function definition">;
def ext_param_not_declared : Extension<
"parameter %0 was not declared, defaulting to type 'int'">;
def err_param_default_argument : Error<
"C does not support default arguments">;
def err_param_default_argument_redefinition : Error<
"redefinition of default argument">;
def ext_param_default_argument_redefinition : ExtWarn<
"redefinition of default argument">, InGroup<Microsoft>;
def err_param_default_argument_missing : Error<
"missing default argument on parameter">;
def err_param_default_argument_missing_name : Error<
"missing default argument on parameter %0">;
def err_param_default_argument_references_param : Error<
"default argument references parameter %0">;
def err_param_default_argument_references_local : Error<
"default argument references local variable %0 of enclosing function">;
def err_param_default_argument_references_this : Error<
"default argument references 'this'">;
def err_param_default_argument_nonfunc : Error<
"default arguments can only be specified for parameters in a function "
"declaration">;
def err_param_default_argument_template_redecl : Error<
"default arguments cannot be added to a function template that has already "
"been declared">;
def err_param_default_argument_member_template_redecl : Error<
"default arguments cannot be added to an out-of-line definition of a member "
"of a %select{class template|class template partial specialization|nested "
"class in a template}0">;
def err_param_default_argument_on_parameter_pack : Error<
"parameter pack cannot have a default argument">;
def err_uninitialized_member_for_assign : Error<
"cannot define the implicit copy assignment operator for %0, because "
"non-static %select{reference|const}1 member %2 can't use copy "
"assignment operator">;
def err_uninitialized_member_in_ctor : Error<
"%select{|implicit default |inheriting }0constructor for %1 must explicitly "
"initialize the %select{reference|const}2 member %3">;
def err_default_arg_makes_ctor_special : Error<
"addition of default argument on redeclaration makes this constructor a "
"%select{default|copy|move}0 constructor">;
def err_use_of_default_argument_to_function_declared_later : Error<
"use of default argument to function %0 that is declared later in class %1">;
def note_default_argument_declared_here : Note<
"default argument declared here">;
def ext_param_promoted_not_compatible_with_prototype : ExtWarn<
"%diff{promoted type $ of K&R function parameter is not compatible with the "
"parameter type $|promoted type of K&R function parameter is not compatible "
"with parameter type}0,1 declared in a previous prototype">,
InGroup<KNRPromotedParameter>;
// C++ Overloading Semantic Analysis.
def err_ovl_diff_return_type : Error<
"functions that differ only in their return type cannot be overloaded">;
def err_ovl_static_nonstatic_member : Error<
"static and non-static member functions with the same parameter types "
"cannot be overloaded">;
def err_ovl_no_viable_function_in_call : Error<
"no matching function for call to %0">;
def err_ovl_no_viable_member_function_in_call : Error<
"no matching member function for call to %0">;
def err_ovl_ambiguous_call : Error<
"call to %0 is ambiguous">;
def err_ovl_deleted_call : Error<
"call to %select{unavailable|deleted}0 function %1%2">;
def err_ovl_ambiguous_member_call : Error<
"call to member function %0 is ambiguous">;
def err_ovl_deleted_member_call : Error<
"call to %select{unavailable|deleted}0 member function %1%2">;
def note_ovl_too_many_candidates : Note<
"remaining %0 candidate%s0 omitted; "
"pass -fshow-overloads=all to show them">;
def note_ovl_candidate : Note<"candidate "
"%select{function|function|constructor|"
"function |function |constructor |"
"is the implicit default constructor|"
"is the implicit copy constructor|"
"is the implicit move constructor|"
"is the implicit copy assignment operator|"
"is the implicit move assignment operator|"
"is an inherited constructor}0%1"
"%select{| has different class%diff{ (expected $ but has $)|}3,4"
"| has different number of parameters (expected %3 but has %4)"
"| has type mismatch at %ordinal3 parameter"
"%diff{ (expected $ but has $)|}4,5"
"| has different return type%diff{ ($ expected but has $)|}3,4"
"| has different qualifiers (expected "
"%select{none|const|restrict|const and restrict|volatile|const and volatile"
"|volatile and restrict|const, volatile, and restrict}3 but found "
"%select{none|const|restrict|const and restrict|volatile|const and volatile"
"|volatile and restrict|const, volatile, and restrict}4)}2">;
def note_ovl_candidate_inherited_constructor : Note<"inherited from here">;
def note_ovl_candidate_illegal_constructor : Note<
"candidate %select{constructor|template}0 ignored: "
"instantiation %select{takes|would take}0 its own class type by value">;
def note_ovl_candidate_bad_deduction : Note<
"candidate template ignored: failed template argument deduction">;
def note_ovl_candidate_incomplete_deduction : Note<"candidate template ignored: "
"couldn't infer template argument %0">;
def note_ovl_candidate_inconsistent_deduction : Note<
"candidate template ignored: deduced conflicting %select{types|values|"
"templates}0 for parameter %1%diff{ ($ vs. $)|}2,3">;
def note_ovl_candidate_explicit_arg_mismatch_named : Note<
"candidate template ignored: invalid explicitly-specified argument "
"for template parameter %0">;
def note_ovl_candidate_explicit_arg_mismatch_unnamed : Note<
"candidate template ignored: invalid explicitly-specified argument "
"for %ordinal0 template parameter">;
def note_ovl_candidate_instantiation_depth : Note<
"candidate template ignored: substitution exceeded maximum template "
"instantiation depth">;
def note_ovl_candidate_underqualified : Note<
"candidate template ignored: can't deduce a type for %0 that would "
"make %2 equal %1">;
def note_ovl_candidate_substitution_failure : Note<
"candidate template ignored: substitution failure%0%1">;
def note_ovl_candidate_disabled_by_enable_if : Note<
"candidate template ignored: disabled by %0%1">;
def note_ovl_candidate_disabled_by_enable_if_attr : Note<
"candidate disabled: %0">;
def note_ovl_candidate_failed_overload_resolution : Note<
"candidate template ignored: couldn't resolve reference to overloaded "
"function %0">;
def note_ovl_candidate_non_deduced_mismatch : Note<
"candidate template ignored: could not match %diff{$ against $|types}0,1">;
// This note is needed because the above note would sometimes print two
// different types with the same name. Remove this note when the above note
// can handle that case properly.
def note_ovl_candidate_non_deduced_mismatch_qualified : Note<
"candidate template ignored: could not match %q0 against %q1">;
// Note that we don't treat templates differently for this diagnostic.
def note_ovl_candidate_arity : Note<"candidate "
"%select{function|function|constructor|function|function|constructor|"
"constructor (the implicit default constructor)|"
"constructor (the implicit copy constructor)|"
"constructor (the implicit move constructor)|"
"function (the implicit copy assignment operator)|"
"function (the implicit move assignment operator)|"
"constructor (inherited)}0 %select{|template }1"
"not viable: requires%select{ at least| at most|}2 %3 argument%s3, but %4 "
"%plural{1:was|:were}4 provided">;
def note_ovl_candidate_arity_one : Note<"candidate "
"%select{function|function|constructor|function|function|constructor|"
"constructor (the implicit default constructor)|"
"constructor (the implicit copy constructor)|"
"constructor (the implicit move constructor)|"
"function (the implicit copy assignment operator)|"
"function (the implicit move assignment operator)|"
"constructor (inherited)}0 %select{|template }1not viable: "
"%select{requires at least|allows at most single|requires single}2 "
"argument %3, but %plural{0:no|:%4}4 arguments were provided">;
def note_ovl_candidate_deleted : Note<
"candidate %select{function|function|constructor|"
"function |function |constructor |"
"constructor (the implicit default constructor)|"
"constructor (the implicit copy constructor)|"
"constructor (the implicit move constructor)|"
"function (the implicit copy assignment operator)|"
"function (the implicit move assignment operator)|"
"constructor (inherited)}0%1 has been "
"%select{explicitly made unavailable|explicitly deleted|"
"implicitly deleted}2">;
// Giving the index of the bad argument really clutters this message, and
// it's relatively unimportant because 1) it's generally obvious which
// argument(s) are of the given object type and 2) the fix is usually
// to complete the type, which doesn't involve changes to the call line
// anyway. If people complain, we can change it.
def note_ovl_candidate_bad_conv_incomplete : Note<"candidate "
"%select{function|function|constructor|"
"function |function |constructor |"
"constructor (the implicit default constructor)|"
"constructor (the implicit copy constructor)|"
"constructor (the implicit move constructor)|"
"function (the implicit copy assignment operator)|"
"function (the implicit move assignment operator)|"
"constructor (inherited)}0%1 "
"not viable: cannot convert argument of incomplete type "
"%diff{$ to $|to parameter type}2,3">;
def note_ovl_candidate_bad_list_argument : Note<"candidate "
"%select{function|function|constructor|"
"function |function |constructor |"
"constructor (the implicit default constructor)|"
"constructor (the implicit copy constructor)|"
"constructor (the implicit move constructor)|"
"function (the implicit copy assignment operator)|"
"function (the implicit move assignment operator)|"
"constructor (inherited)}0%1 "
"not viable: cannot convert initializer list argument to %3">;
def note_ovl_candidate_bad_overload : Note<"candidate "
"%select{function|function|constructor|"
"function |function |constructor |"
"constructor (the implicit default constructor)|"
"constructor (the implicit copy constructor)|"
"constructor (the implicit move constructor)|"
"function (the implicit copy assignment operator)|"
"function (the implicit move assignment operator)|"
"constructor (inherited)}0%1"
" not viable: no overload of %3 matching %2 for %ordinal4 argument">;
def note_ovl_candidate_bad_conv : Note<"candidate "
"%select{function|function|constructor|"
"function |function |constructor |"
"constructor (the implicit default constructor)|"
"constructor (the implicit copy constructor)|"
"constructor (the implicit move constructor)|"
"function (the implicit copy assignment operator)|"
"function (the implicit move assignment operator)|"
"constructor (inherited)}0%1"
" not viable: no known conversion "
"%diff{from $ to $|from argument type to parameter type}2,3 for "
"%select{%ordinal5 argument|object argument}4"
"%select{|; dereference the argument with *|"
"; take the address of the argument with &|"
"; remove *|"
"; remove &}6">;
def note_ovl_candidate_bad_arc_conv : Note<"candidate "
"%select{function|function|constructor|"
"function |function |constructor |"
"constructor (the implicit default constructor)|"
"constructor (the implicit copy constructor)|"
"constructor (the implicit move constructor)|"
"function (the implicit copy assignment operator)|"
"function (the implicit move assignment operator)|"
"constructor (inherited)}0%1"
" not viable: cannot implicitly convert argument "
"%diff{of type $ to $|type to parameter type}2,3 for "
"%select{%ordinal5 argument|object argument}4 under ARC">;
def note_ovl_candidate_bad_lvalue : Note<"candidate "
"%select{function|function|constructor|"
"function |function |constructor |"
"constructor (the implicit default constructor)|"
"constructor (the implicit copy constructor)|"
"constructor (the implicit move constructor)|"
"function (the implicit copy assignment operator)|"
"function (the implicit move assignment operator)|"
"constructor (inherited)}0%1"
" not viable: expects an l-value for "
"%select{%ordinal3 argument|object argument}2">;
def note_ovl_candidate_bad_addrspace : Note<"candidate "
"%select{function|function|constructor|"
"function |function |constructor |"
"constructor (the implicit default constructor)|"
"constructor (the implicit copy constructor)|"
"constructor (the implicit move constructor)|"
"function (the implicit copy assignment operator)|"
"function (the implicit move assignment operator)|"
"constructor (inherited)}0%1 not viable: "
"%select{%ordinal6|'this'}5 argument (%2) is in "
"address space %3, but parameter must be in address space %4">;
def note_ovl_candidate_bad_gc : Note<"candidate "
"%select{function|function|constructor|"
"function |function |constructor |"
"constructor (the implicit default constructor)|"
"constructor (the implicit copy constructor)|"
"constructor (the implicit move constructor)|"
"function (the implicit copy assignment operator)|"
"function (the implicit move assignment operator)|"
"constructor (inherited)}0%1 not viable: "
"%select{%ordinal6|'this'}5 argument (%2) has %select{no|__weak|__strong}3 "
"ownership, but parameter has %select{no|__weak|__strong}4 ownership">;
def note_ovl_candidate_bad_ownership : Note<"candidate "
"%select{function|function|constructor|"
"function |function |constructor |"
"constructor (the implicit default constructor)|"
"constructor (the implicit copy constructor)|"
"constructor (the implicit move constructor)|"
"function (the implicit copy assignment operator)|"
"function (the implicit move assignment operator)|"
"constructor (inherited)}0%1 not viable: "
"%select{%ordinal6|'this'}5 argument (%2) has "
"%select{no|__unsafe_unretained|__strong|__weak|__autoreleasing}3 ownership,"
" but parameter has %select{no|__unsafe_unretained|__strong|__weak|"
"__autoreleasing}4 ownership">;
def note_ovl_candidate_bad_cvr_this : Note<"candidate "
"%select{|function|||function|||||"
"function (the implicit copy assignment operator)|"
"function (the implicit move assignment operator)|}0 not viable: "
"'this' argument has type %2, but method is not marked "
"%select{const|restrict|const or restrict|volatile|const or volatile|"
"volatile or restrict|const, volatile, or restrict}3">;
def note_ovl_candidate_bad_cvr : Note<"candidate "
"%select{function|function|constructor|"
"function |function |constructor |"
"constructor (the implicit default constructor)|"
"constructor (the implicit copy constructor)|"
"constructor (the implicit move constructor)|"
"function (the implicit copy assignment operator)|"
"function (the implicit move assignment operator)|"
"constructor (inherited)}0%1 not viable: "
"%ordinal4 argument (%2) would lose "
"%select{const|restrict|const and restrict|volatile|const and volatile|"
"volatile and restrict|const, volatile, and restrict}3 qualifier"
"%select{||s||s|s|s}3">;
def note_ovl_candidate_bad_base_to_derived_conv : Note<"candidate "
"%select{function|function|constructor|"
"function |function |constructor |"
"constructor (the implicit default constructor)|"
"constructor (the implicit copy constructor)|"
"constructor (the implicit move constructor)|"
"function (the implicit copy assignment operator)|"
"function (the implicit move assignment operator)|"
"constructor (inherited)}0%1"
" not viable: cannot %select{convert from|convert from|bind}2 "
"%select{base class pointer|superclass|base class object of type}2 %3 to "
"%select{derived class pointer|subclass|derived class reference}2 %4 for "
"%ordinal5 argument">;
def note_ovl_candidate_bad_target : Note<
"candidate %select{function|function|constructor|"
"function |function |constructor |"
"constructor (the implicit default constructor)|"
"constructor (the implicit copy constructor)|"
"constructor (the implicit move constructor)|"
"function (the implicit copy assignment operator)|"
"function (the implicit move assignment operator)|"
"constructor (inherited)}0 not viable: call to "
"%select{__device__|__global__|__host__|__host__ __device__|invalid}1 function from"
" %select{__device__|__global__|__host__|__host__ __device__|invalid}2 function">;
def note_implicit_member_target_infer_collision : Note<
"implicit %select{"
"default constructor|"
"copy constructor|"
"move constructor|"
"copy assignment operator|"
"move assignment operator|"
"destructor}0 inferred target collision: call to both "
"%select{__device__|__global__|__host__|__host__ __device__}1 and "
"%select{__device__|__global__|__host__|__host__ __device__}2 members">;
def note_ambiguous_type_conversion: Note<
"because of ambiguity in conversion %diff{of $ to $|between types}0,1">;
def note_ovl_builtin_binary_candidate : Note<
"built-in candidate %0">;
def note_ovl_builtin_unary_candidate : Note<
"built-in candidate %0">;
def err_ovl_no_viable_function_in_init : Error<
"no matching constructor for initialization of %0">;
def err_ovl_no_conversion_in_cast : Error<
"cannot convert %1 to %2 without a conversion operator">;
def err_ovl_no_viable_conversion_in_cast : Error<
"no matching conversion for %select{|static_cast|reinterpret_cast|"
"dynamic_cast|C-style cast|functional-style cast}0 from %1 to %2">;
def err_ovl_ambiguous_conversion_in_cast : Error<
"ambiguous conversion for %select{|static_cast|reinterpret_cast|"
"dynamic_cast|C-style cast|functional-style cast}0 from %1 to %2">;
def err_ovl_deleted_conversion_in_cast : Error<
"%select{|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
"functional-style cast}0 from %1 to %2 uses deleted function">;
def err_ovl_ambiguous_init : Error<"call to constructor of %0 is ambiguous">;
def err_ref_init_ambiguous : Error<
"reference initialization of type %0 with initializer of type %1 is ambiguous">;
def err_ovl_deleted_init : Error<
"call to %select{unavailable|deleted}0 constructor of %1">;
def err_ovl_deleted_special_init : Error<
"call to implicitly-deleted %select{default constructor|copy constructor|"
"move constructor|copy assignment operator|move assignment operator|"
"destructor|function}0 of %1">;
def err_ovl_ambiguous_oper_unary : Error<
"use of overloaded operator '%0' is ambiguous (operand type %1)">;
def err_ovl_ambiguous_oper_binary : Error<
"use of overloaded operator '%0' is ambiguous (with operand types %1 and %2)">;
def err_ovl_no_viable_oper : Error<"no viable overloaded '%0'">;
def note_assign_lhs_incomplete : Note<"type %0 is incomplete">;
def err_ovl_deleted_oper : Error<
"overload resolution selected %select{unavailable|deleted}0 operator '%1'%2">;
def err_ovl_deleted_special_oper : Error<
"object of type %0 cannot be %select{constructed|copied|moved|assigned|"
"assigned|destroyed}1 because its %select{default constructor|"
"copy constructor|move constructor|copy assignment operator|"
"move assignment operator|destructor}1 is implicitly deleted">;
def err_ovl_no_viable_subscript :
Error<"no viable overloaded operator[] for type %0">;
def err_ovl_no_oper :
Error<"type %0 does not provide a %select{subscript|call}1 operator">;
def err_ovl_unresolvable : Error<
"reference to overloaded function could not be resolved; "
"did you mean to call it%select{| with no arguments}0?">;
def err_bound_member_function : Error<
"reference to non-static member function must be called"
"%select{|; did you mean to call it with no arguments?}0">;
def note_possible_target_of_call : Note<"possible target for call">;
def err_ovl_no_viable_object_call : Error<
"no matching function for call to object of type %0">;
def err_ovl_ambiguous_object_call : Error<
"call to object of type %0 is ambiguous">;
def err_ovl_deleted_object_call : Error<
"call to %select{unavailable|deleted}0 function call operator in type %1%2">;
def note_ovl_surrogate_cand : Note<"conversion candidate of type %0">;
def err_member_call_without_object : Error<
"call to non-static member function without an object argument">;
// C++ Address of Overloaded Function
def err_addr_ovl_no_viable : Error<
"address of overloaded function %0 does not match required type %1">;
def err_addr_ovl_ambiguous : Error<
"address of overloaded function %0 is ambiguous">;
def err_addr_ovl_not_func_ptrref : Error<
"address of overloaded function %0 cannot be converted to type %1">;
def err_addr_ovl_no_qualifier : Error<
"can't form member pointer of type %0 without '&' and class name">;
// C++11 Literal Operators
def err_ovl_no_viable_literal_operator : Error<
"no matching literal operator for call to %0"
"%select{| with argument of type %2| with arguments of types %2 and %3}1"
"%select{| or 'const char *'}4"
"%select{|, and no matching literal operator template}5">;
// C++ Template Declarations
def err_template_param_shadow : Error<
"declaration of %0 shadows template parameter">;
def note_template_param_here : Note<"template parameter is declared here">;
def warn_template_export_unsupported : Warning<
"exported templates are unsupported">;
def err_template_outside_namespace_or_class_scope : Error<
"templates can only be declared in namespace or class scope">;
def err_template_inside_local_class : Error<
"templates cannot be declared inside of a local class">;
def err_template_linkage : Error<"templates must have C++ linkage">;
def err_template_typedef : Error<"a typedef cannot be a template">;
def err_template_unnamed_class : Error<
"cannot declare a class template with no name">;
def err_template_param_list_different_arity : Error<
"%select{too few|too many}0 template parameters in template "
"%select{|template parameter }1redeclaration">;
def note_template_param_list_different_arity : Note<
"%select{too few|too many}0 template parameters in template template "
"argument">;
def note_template_prev_declaration : Note<
"previous template %select{declaration|template parameter}0 is here">;
def err_template_param_different_kind : Error<
"template parameter has a different kind in template "
"%select{|template parameter }0redeclaration">;
def note_template_param_different_kind : Note<
"template parameter has a different kind in template argument">;
def err_template_nontype_parm_different_type : Error<
"template non-type parameter has a different type %0 in template "
"%select{|template parameter }1redeclaration">;
def note_template_nontype_parm_different_type : Note<
"template non-type parameter has a different type %0 in template argument">;
def note_template_nontype_parm_prev_declaration : Note<
"previous non-type template parameter with type %0 is here">;
def err_template_nontype_parm_bad_type : Error<
"a non-type template parameter cannot have type %0">;
def err_template_param_default_arg_redefinition : Error<
"template parameter redefines default argument">;
def note_template_param_prev_default_arg : Note<
"previous default template argument defined here">;
def err_template_param_default_arg_missing : Error<
"template parameter missing a default argument">;
def ext_template_parameter_default_in_function_template : ExtWarn<
"default template arguments for a function template are a C++11 extension">,
InGroup<CXX11>;
def warn_cxx98_compat_template_parameter_default_in_function_template : Warning<
"default template arguments for a function template are incompatible with C++98">,
InGroup<CXX98Compat>, DefaultIgnore;
def err_template_parameter_default_template_member : Error<
"cannot add a default template argument to the definition of a member of a "
"class template">;
def err_template_parameter_default_friend_template : Error<
"default template argument not permitted on a friend template">;
def err_template_template_parm_no_parms : Error<
"template template parameter must have its own template parameters">;
def ext_variable_template : ExtWarn<"variable templates are a C++14 extension">,
InGroup<CXX14>;
def warn_cxx11_compat_variable_template : Warning<
"variable templates are incompatible with C++ standards before C++14">,
InGroup<CXXPre14Compat>, DefaultIgnore;
def err_template_variable_noparams : Error<
"extraneous 'template<>' in declaration of variable %0">;
def err_template_member : Error<"member %0 declared as a template">;
def err_template_member_noparams : Error<
"extraneous 'template<>' in declaration of member %0">;
def err_template_tag_noparams : Error<
"extraneous 'template<>' in declaration of %0 %1">;
def err_template_decl_ref : Error<
"cannot refer to %select{class|variable}0 template %1 without a template argument list">;
// C++ Template Argument Lists
def err_template_missing_args : Error<
"use of class template %0 requires template arguments">;
def err_template_arg_list_different_arity : Error<
"%select{too few|too many}0 template arguments for "
"%select{class template|function template|template template parameter"
"|template}1 %2">;
def note_template_decl_here : Note<"template is declared here">;
def err_template_arg_must_be_type : Error<
"template argument for template type parameter must be a type">;
def err_template_arg_must_be_type_suggest : Error<
"template argument for template type parameter must be a type; did you forget 'typename'?">;
def ext_ms_template_type_arg_missing_typename : ExtWarn<
"template argument for template type parameter must be a type; "
"omitted 'typename' is a Microsoft extension">,
InGroup<Microsoft>;
def err_template_arg_must_be_expr : Error<
"template argument for non-type template parameter must be an expression">;
def err_template_arg_nontype_ambig : Error<
"template argument for non-type template parameter is treated as function type %0">;
def err_template_arg_must_be_template : Error<
"template argument for template template parameter must be a class template%select{| or type alias template}0">;
def ext_template_arg_local_type : ExtWarn<
"template argument uses local type %0">, InGroup<LocalTypeTemplateArgs>;
def ext_template_arg_unnamed_type : ExtWarn<
"template argument uses unnamed type">, InGroup<UnnamedTypeTemplateArgs>;
def warn_cxx98_compat_template_arg_local_type : Warning<
"local type %0 as template argument is incompatible with C++98">,
InGroup<CXX98CompatLocalTypeTemplateArgs>, DefaultIgnore;
def warn_cxx98_compat_template_arg_unnamed_type : Warning<
"unnamed type as template argument is incompatible with C++98">,
InGroup<CXX98CompatUnnamedTypeTemplateArgs>, DefaultIgnore;
def note_template_unnamed_type_here : Note<
"unnamed type used in template argument was declared here">;
def err_template_arg_overload_type : Error<
"template argument is the type of an unresolved overloaded function">;
def err_template_arg_not_class_template : Error<
"template argument does not refer to a class template or template "
"template parameter">;
def note_template_arg_refers_here_func : Note<
"template argument refers to function template %0, here">;
def err_template_arg_template_params_mismatch : Error<
"template template argument has different template parameters than its "
"corresponding template template parameter">;
def err_template_arg_not_integral_or_enumeral : Error<
"non-type template argument of type %0 must have an integral or enumeration"
" type">;
def err_template_arg_not_ice : Error<
"non-type template argument of type %0 is not an integral constant "
"expression">;
def err_template_arg_not_address_constant : Error<
"non-type template argument of type %0 is not a constant expression">;
def warn_cxx98_compat_template_arg_null : Warning<
"use of null pointer as non-type template argument is incompatible with "
"C++98">, InGroup<CXX98Compat>, DefaultIgnore;
def err_template_arg_untyped_null_constant : Error<
"null non-type template argument must be cast to template parameter type %0">;
def err_template_arg_wrongtype_null_constant : Error<
"null non-type template argument of type %0 does not match template parameter "
"of type %1">;
def err_deduced_non_type_template_arg_type_mismatch : Error<
"deduced non-type template argument does not have the same type as the "
"its corresponding template parameter%diff{ ($ vs $)|}0,1">;
def err_non_type_template_arg_subobject : Error<
"non-type template argument refers to subobject '%0'">;
def err_non_type_template_arg_addr_label_diff : Error<
"template argument / label address difference / what did you expect?">;
def err_template_arg_not_convertible : Error<
"non-type template argument of type %0 cannot be converted to a value "
"of type %1">;
def warn_template_arg_negative : Warning<
"non-type template argument with value '%0' converted to '%1' for unsigned "
"template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
def warn_template_arg_too_large : Warning<
"non-type template argument value '%0' truncated to '%1' for "
"template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
def err_template_arg_no_ref_bind : Error<
"non-type template parameter of reference type "
"%diff{$ cannot bind to template argument of type $"
"|cannot bind to template of incompatible argument type}0,1">;
def err_template_arg_ref_bind_ignores_quals : Error<
"reference binding of non-type template parameter "
"%diff{of type $ to template argument of type $|to template argument}0,1 "
"ignores qualifiers">;
def err_template_arg_not_decl_ref : Error<
"non-type template argument does not refer to any declaration">;
def err_template_arg_not_address_of : Error<
"non-type template argument for template parameter of pointer type %0 must "
"have its address taken">;
def err_template_arg_address_of_non_pointer : Error<
"address taken in non-type template argument for template parameter of "
"reference type %0">;
def err_template_arg_reference_var : Error<
"non-type template argument of reference type %0 is not an object">;
def err_template_arg_field : Error<
"non-type template argument refers to non-static data member %0">;
def err_template_arg_method : Error<
"non-type template argument refers to non-static member function %0">;
def err_template_arg_object_no_linkage : Error<
"non-type template argument refers to %select{function|object}0 %1 that "
"does not have linkage">;
def warn_cxx98_compat_template_arg_object_internal : Warning<
"non-type template argument referring to %select{function|object}0 %1 with "
"internal linkage is incompatible with C++98">,
InGroup<CXX98Compat>, DefaultIgnore;
def ext_template_arg_object_internal : ExtWarn<
"non-type template argument referring to %select{function|object}0 %1 with "
"internal linkage is a C++11 extension">, InGroup<CXX11>;
def err_template_arg_thread_local : Error<
"non-type template argument refers to thread-local object">;
def note_template_arg_internal_object : Note<
"non-type template argument refers to %select{function|object}0 here">;
def note_template_arg_refers_here : Note<
"non-type template argument refers here">;
def err_template_arg_not_object_or_func : Error<
"non-type template argument does not refer to an object or function">;
def err_template_arg_not_pointer_to_member_form : Error<
"non-type template argument is not a pointer to member constant">;
def err_template_arg_member_ptr_base_derived_not_supported : Error<
"sorry, non-type template argument of pointer-to-member type %1 that refers "
"to member %q0 of a different class is not supported yet">;
def ext_template_arg_extra_parens : ExtWarn<
"address non-type template argument cannot be surrounded by parentheses">;
def warn_cxx98_compat_template_arg_extra_parens : Warning<
"redundant parentheses surrounding address non-type template argument are "
"incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
def err_pointer_to_member_type : Error<
"invalid use of pointer to member type after %select{.*|->*}0">;
def err_pointer_to_member_call_drops_quals : Error<
"call to pointer to member function of type %0 drops '%1' qualifier%s2">;
def err_pointer_to_member_oper_value_classify: Error<
"pointer-to-member function type %0 can only be called on an "
"%select{rvalue|lvalue}1">;
def ext_ms_deref_template_argument: ExtWarn<
"non-type template argument containing a dereference operation is a "
"Microsoft extension">, InGroup<Microsoft>;
def ext_ms_delayed_template_argument: ExtWarn<
"using the undeclared type %0 as a default template argument is a "
"Microsoft extension">, InGroup<Microsoft>;
// C++ template specialization
def err_template_spec_unknown_kind : Error<
"can only provide an explicit specialization for a class template, function "
"template, variable template, or a member function, static data member, "
"%select{or member class|member class, or member enumeration}0 of a "
"class template">;
def note_specialized_entity : Note<
"explicitly specialized declaration is here">;
def err_template_spec_decl_function_scope : Error<
"explicit specialization of %0 in function scope">;
def err_template_spec_decl_class_scope : Error<
"explicit specialization of %0 in class scope">;
def err_template_spec_decl_friend : Error<
"cannot declare an explicit specialization in a friend">;
def err_template_spec_decl_out_of_scope_global : Error<
"%select{class template|class template partial|variable template|"
"variable template partial|function template|member function|"
"static data member|member class|member enumeration}0 "
"specialization of %1 must originally be declared in the global scope">;
def err_template_spec_decl_out_of_scope : Error<
"%select{class template|class template partial|variable template|"
"variable template partial|function template|member "
"function|static data member|member class|member enumeration}0 "
"specialization of %1 must originally be declared in namespace %2">;
def ext_template_spec_decl_out_of_scope : ExtWarn<
"first declaration of %select{class template|class template partial|"
"variable template|variable template partial|"
"function template|member function|static data member|member class|"
"member enumeration}0 specialization of %1 outside namespace %2 is a "
"C++11 extension">, InGroup<CXX11>;
def warn_cxx98_compat_template_spec_decl_out_of_scope : Warning<
"%select{class template|class template partial|variable template|"
"variable template partial|function template|member "
"function|static data member|member class|member enumeration}0 "
"specialization of %1 outside namespace %2 is incompatible with C++98">,
InGroup<CXX98Compat>, DefaultIgnore;
def err_template_spec_redecl_out_of_scope : Error<
"%select{class template|class template partial|variable template|"
"variable template partial|function template|member "
"function|static data member|member class|member enumeration}0 "
"specialization of %1 not in a namespace enclosing %2">;
def ext_ms_template_spec_redecl_out_of_scope: ExtWarn<
"%select{class template|class template partial|variable template|"
"variable template partial|function template|member "
"function|static data member|member class|member enumeration}0 "
"specialization of %1 outside namespace enclosing %2 "
"is a Microsoft extension">, InGroup<Microsoft>;
def err_template_spec_redecl_global_scope : Error<
"%select{class template|class template partial|variable template|"
"variable template partial|function template|member "
"function|static data member|member class|member enumeration}0 "
"specialization of %1 must occur at global scope">;
def err_spec_member_not_instantiated : Error<
"specialization of member %q0 does not specialize an instantiated member">;
def note_specialized_decl : Note<"attempt to specialize declaration here">;
def err_specialization_after_instantiation : Error<
"explicit specialization of %0 after instantiation">;
def note_instantiation_required_here : Note<
"%select{implicit|explicit}0 instantiation first required here">;
def err_template_spec_friend : Error<
"template specialization declaration cannot be a friend">;
def err_template_spec_default_arg : Error<
"default argument not permitted on an explicit "
"%select{instantiation|specialization}0 of function %1">;
def err_not_class_template_specialization : Error<
"cannot specialize a %select{dependent template|template template "
"parameter}0">;
def err_function_specialization_in_class : Error<
"cannot specialize a function %0 within class scope">;
def ext_function_specialization_in_class : ExtWarn<
"explicit specialization of %0 within class scope is a Microsoft extension">,
InGroup<Microsoft>;
def ext_explicit_specialization_storage_class : ExtWarn<
"explicit specialization cannot have a storage class">;
def err_explicit_specialization_inconsistent_storage_class : Error<
"explicit specialization has extraneous, inconsistent storage class "
"'%select{none|extern|static|__private_extern__|auto|register}0'">;
// C++ class template specializations and out-of-line definitions
def err_template_spec_needs_header : Error<
"template specialization requires 'template<>'">;
def err_template_spec_needs_template_parameters : Error<
"template specialization or definition requires a template parameter list "
"corresponding to the nested type %0">;
def err_template_param_list_matches_nontemplate : Error<
"template parameter list matching the non-templated nested type %0 should "
"be empty ('template<>')">;
def err_alias_template_extra_headers : Error<
"extraneous template parameter list in alias template declaration">;
def err_template_spec_extra_headers : Error<
"extraneous template parameter list in template specialization or "
"out-of-line template definition">;
def warn_template_spec_extra_headers : Warning<
"extraneous template parameter list in template specialization">;
def note_explicit_template_spec_does_not_need_header : Note<
"'template<>' header not required for explicitly-specialized class %0 "
"declared here">;
def err_template_qualified_declarator_no_match : Error<
"nested name specifier '%0' for declaration does not refer into a class, "
"class template or class template partial specialization">;
def err_specialize_member_of_template : Error<
"cannot specialize %select{|(with 'template<>') }0a member of an "
"unspecialized template">;
// C++ Class Template Partial Specialization
def err_default_arg_in_partial_spec : Error<
"default template argument in a class template partial specialization">;
def err_dependent_non_type_arg_in_partial_spec : Error<
"non-type template argument depends on a template parameter of the "
"partial specialization">;
def note_dependent_non_type_default_arg_in_partial_spec : Note<
"template parameter is used in default argument declared here">;
def err_dependent_typed_non_type_arg_in_partial_spec : Error<
"non-type template argument specializes a template parameter with "
"dependent type %0">;
def err_partial_spec_args_match_primary_template : Error<
"%select{class|variable}0 template partial specialization does not "
"specialize any template argument; to %select{declare|define}1 the "
"primary template, remove the template argument list">;
def warn_partial_specs_not_deducible : Warning<
"%select{class|variable}0 template partial specialization contains "
"%select{a template parameter|template parameters}1 that cannot be "
"deduced; this partial specialization will never be used">;
def note_partial_spec_unused_parameter : Note<
"non-deducible template parameter %0">;
def err_partial_spec_ordering_ambiguous : Error<
"ambiguous partial specializations of %0">;
def note_partial_spec_match : Note<"partial specialization matches %0">;
def err_partial_spec_redeclared : Error<
"class template partial specialization %0 cannot be redeclared">;
def note_prev_partial_spec_here : Note<
"previous declaration of class template partial specialization %0 is here">;
def err_partial_spec_fully_specialized : Error<
"partial specialization of %0 does not use any of its template parameters">;
// C++ Variable Template Partial Specialization
def err_var_partial_spec_redeclared : Error<
"variable template partial specialization %0 cannot be redefined">;
def note_var_prev_partial_spec_here : Note<
"previous declaration of variable template partial specialization is here">;
def err_var_spec_no_template : Error<
"no variable template matches%select{| partial}0 specialization">;
def err_var_spec_no_template_but_method : Error<
"no variable template matches specialization; "
"did you mean to use %0 as function template instead?">;
// C++ Function template specializations
def err_function_template_spec_no_match : Error<
"no function template matches function template specialization %0">;
def err_function_template_spec_ambiguous : Error<
"function template specialization %0 ambiguously refers to more than one "
"function template; explicitly specify%select{| additional}1 template "
"arguments to identify a particular function template">;
def note_function_template_spec_matched : Note<
"function template matches specialization %0">;
def err_function_template_partial_spec : Error<
"function template partial specialization is not allowed">;
// C++ Template Instantiation
def err_template_recursion_depth_exceeded : Error<
"recursive template instantiation exceeded maximum depth of %0">,
DefaultFatal, NoSFINAE;
def note_template_recursion_depth : Note<
"use -ftemplate-depth=N to increase recursive template instantiation depth">;
def err_template_instantiate_within_definition : Error<
"%select{implicit|explicit}0 instantiation of template %1 within its"
" own definition">;
def err_template_instantiate_undefined : Error<
"%select{implicit|explicit}0 instantiation of undefined template %1">;
def err_implicit_instantiate_member_undefined : Error<
"implicit instantiation of undefined member %0">;
def note_template_class_instantiation_was_here : Note<
"class template %0 was instantiated here">;
def note_template_class_explicit_specialization_was_here : Note<
"class template %0 was explicitly specialized here">;
def note_template_class_instantiation_here : Note<
"in instantiation of template class %0 requested here">;
def note_template_member_class_here : Note<
"in instantiation of member class %0 requested here">;
def note_template_member_function_here : Note<
"in instantiation of member function %q0 requested here">;
def note_function_template_spec_here : Note<
"in instantiation of function template specialization %q0 requested here">;
def note_template_static_data_member_def_here : Note<
"in instantiation of static data member %q0 requested here">;
def note_template_variable_def_here : Note<
"in instantiation of variable template specialization %q0 requested here">;
def note_template_enum_def_here : Note<
"in instantiation of enumeration %q0 requested here">;
def note_template_nsdmi_here : Note<
"in instantiation of default member initializer %q0 requested here">;
def note_template_type_alias_instantiation_here : Note<
"in instantiation of template type alias %0 requested here">;
def note_template_exception_spec_instantiation_here : Note<
"in instantiation of exception specification for %0 requested here">;
def note_default_arg_instantiation_here : Note<
"in instantiation of default argument for '%0' required here">;
def note_default_function_arg_instantiation_here : Note<
"in instantiation of default function argument expression "
"for '%0' required here">;
def note_explicit_template_arg_substitution_here : Note<
"while substituting explicitly-specified template arguments into function "
"template %0 %1">;
def note_function_template_deduction_instantiation_here : Note<
"while substituting deduced template arguments into function template %0 "
"%1">;
def note_partial_spec_deduct_instantiation_here : Note<
"during template argument deduction for class template partial "
"specialization %0 %1">;
def note_prior_template_arg_substitution : Note<
"while substituting prior template arguments into %select{non-type|template}0"
" template parameter%1 %2">;
def note_template_default_arg_checking : Note<
"while checking a default template argument used here">;
def note_instantiation_contexts_suppressed : Note<
"(skipping %0 context%s0 in backtrace; use -ftemplate-backtrace-limit=0 to "
"see all)">;
def err_field_instantiates_to_function : Error<
"data member instantiated with function type %0">;
def err_variable_instantiates_to_function : Error<
"%select{variable|static data member}0 instantiated with function type %1">;
def err_nested_name_spec_non_tag : Error<
"type %0 cannot be used prior to '::' because it has no members">;
// C++ Explicit Instantiation
def err_explicit_instantiation_duplicate : Error<
"duplicate explicit instantiation of %0">;
def ext_explicit_instantiation_duplicate : ExtWarn<
"duplicate explicit instantiation of %0 ignored as a Microsoft extension">,
InGroup<Microsoft>;
def note_previous_explicit_instantiation : Note<
"previous explicit instantiation is here">;
def ext_explicit_instantiation_after_specialization : Extension<
"explicit instantiation of %0 that occurs after an explicit "
"specialization will be ignored (C++11 extension)">,
InGroup<CXX11>;
def warn_cxx98_compat_explicit_instantiation_after_specialization : Warning<
"explicit instantiation of %0 that occurs after an explicit "
"specialization is incompatible with C++98">,
InGroup<CXX98CompatPedantic>, DefaultIgnore;
def note_previous_template_specialization : Note<
"previous template specialization is here">;
def err_explicit_instantiation_nontemplate_type : Error<
"explicit instantiation of non-templated type %0">;
def note_nontemplate_decl_here : Note<
"non-templated declaration is here">;
def err_explicit_instantiation_in_class : Error<
"explicit instantiation of %0 in class scope">;
def err_explicit_instantiation_out_of_scope : Error<
"explicit instantiation of %0 not in a namespace enclosing %1">;
def err_explicit_instantiation_must_be_global : Error<
"explicit instantiation of %0 must occur at global scope">;
def warn_explicit_instantiation_out_of_scope_0x : Warning<
"explicit instantiation of %0 not in a namespace enclosing %1">,
InGroup<CXX11Compat>, DefaultIgnore;
def warn_explicit_instantiation_must_be_global_0x : Warning<
"explicit instantiation of %0 must occur at global scope">,
InGroup<CXX11Compat>, DefaultIgnore;
def err_explicit_instantiation_requires_name : Error<
"explicit instantiation declaration requires a name">;
def err_explicit_instantiation_of_typedef : Error<
"explicit instantiation of typedef %0">;
def err_explicit_instantiation_storage_class : Error<
"explicit instantiation cannot have a storage class">;
def err_explicit_instantiation_not_known : Error<
"explicit instantiation of %0 does not refer to a function template, "
"variable template, member function, member class, or static data member">;
def note_explicit_instantiation_here : Note<
"explicit instantiation refers here">;
def err_explicit_instantiation_data_member_not_instantiated : Error<
"explicit instantiation refers to static data member %q0 that is not an "
"instantiation">;
def err_explicit_instantiation_member_function_not_instantiated : Error<
"explicit instantiation refers to member function %q0 that is not an "
"instantiation">;
def err_explicit_instantiation_ambiguous : Error<
"partial ordering for explicit instantiation of %0 is ambiguous">;
def note_explicit_instantiation_candidate : Note<
"explicit instantiation candidate function template here %0">;
def err_explicit_instantiation_inline : Error<
"explicit instantiation cannot be 'inline'">;
def warn_explicit_instantiation_inline_0x : Warning<
"explicit instantiation cannot be 'inline'">, InGroup<CXX11Compat>,
DefaultIgnore;
def err_explicit_instantiation_constexpr : Error<
"explicit instantiation cannot be 'constexpr'">;
def ext_explicit_instantiation_without_qualified_id : Extension<
"qualifier in explicit instantiation of %q0 requires a template-id "
"(a typedef is not permitted)">;
def err_explicit_instantiation_without_template_id : Error<
"explicit instantiation of %q0 must specify a template argument list">;
def err_explicit_instantiation_unqualified_wrong_namespace : Error<
"explicit instantiation of %q0 must occur in namespace %1">;
def warn_explicit_instantiation_unqualified_wrong_namespace_0x : Warning<
"explicit instantiation of %q0 must occur in namespace %1">,
InGroup<CXX11Compat>, DefaultIgnore;
def err_explicit_instantiation_undefined_member : Error<
"explicit instantiation of undefined %select{member class|member function|"
"static data member}0 %1 of class template %2">;
def err_explicit_instantiation_undefined_func_template : Error<
"explicit instantiation of undefined function template %0">;
def err_explicit_instantiation_undefined_var_template : Error<
"explicit instantiation of undefined variable template %q0">;
def err_explicit_instantiation_declaration_after_definition : Error<
"explicit instantiation declaration (with 'extern') follows explicit "
"instantiation definition (without 'extern')">;
def note_explicit_instantiation_definition_here : Note<
"explicit instantiation definition is here">;
def err_invalid_var_template_spec_type : Error<"type %2 "
"of %select{explicit instantiation|explicit specialization|"
"partial specialization|redeclaration}0 of %1 does not match"
" expected type %3">;
def err_mismatched_exception_spec_explicit_instantiation : Error<
"exception specification in explicit instantiation does not match instantiated one">;
def ext_mismatched_exception_spec_explicit_instantiation : ExtWarn<
"exception specification in explicit instantiation does not match instantiated one">,
InGroup<Microsoft>;
// C++ typename-specifiers
def err_typename_nested_not_found : Error<"no type named %0 in %1">;
def err_typename_nested_not_found_enable_if : Error<
"no type named 'type' in %0; 'enable_if' cannot be used to disable "
"this declaration">;
def err_typename_nested_not_type : Error<
"typename specifier refers to non-type member %0 in %1">;
def note_typename_refers_here : Note<
"referenced member %0 is declared here">;
def err_typename_missing : Error<
"missing 'typename' prior to dependent type name '%0%1'">;
def ext_typename_missing : ExtWarn<
"missing 'typename' prior to dependent type name '%0%1'">,
InGroup<DiagGroup<"typename-missing">>;
def ext_typename_outside_of_template : ExtWarn<
"'typename' occurs outside of a template">, InGroup<CXX11>;
def warn_cxx98_compat_typename_outside_of_template : Warning<
"use of 'typename' outside of a template is incompatible with C++98">,
InGroup<CXX98Compat>, DefaultIgnore;
def err_typename_refers_to_using_value_decl : Error<
"typename specifier refers to a dependent using declaration for a value "
"%0 in %1">;
def note_using_value_decl_missing_typename : Note<
"add 'typename' to treat this using declaration as a type">;
def err_template_kw_refers_to_non_template : Error<
"%0 following the 'template' keyword does not refer to a template">;
def err_template_kw_refers_to_class_template : Error<
"'%0%1' instantiated to a class template, not a function template">;
def note_referenced_class_template : Error<
"class template declared here">;
def err_template_kw_missing : Error<
"missing 'template' keyword prior to dependent template name '%0%1'">;
def ext_template_outside_of_template : ExtWarn<
"'template' keyword outside of a template">, InGroup<CXX11>;
def warn_cxx98_compat_template_outside_of_template : Warning<
"use of 'template' keyword outside of a template is incompatible with C++98">,
InGroup<CXX98Compat>, DefaultIgnore;
def err_non_type_template_in_nested_name_specifier : Error<
"qualified name refers into a specialization of %select{function|variable}0 "
"template %1">;
def err_template_id_not_a_type : Error<
"template name refers to non-type template %0">;
def note_template_declared_here : Note<
"%select{function template|class template|variable template"
"|type alias template|template template parameter}0 "
"%1 declared here">;
def err_alias_template_expansion_into_fixed_list : Error<
"pack expansion used as argument for non-pack parameter of alias template">;
def note_parameter_type : Note<
"parameter of type %0 is declared here">;
// C++11 Variadic Templates
def err_template_param_pack_default_arg : Error<
"template parameter pack cannot have a default argument">;
def err_template_param_pack_must_be_last_template_parameter : Error<
"template parameter pack must be the last template parameter">;
def err_template_parameter_pack_non_pack : Error<
"%select{template type|non-type template|template template}0 parameter"
"%select{| pack}1 conflicts with previous %select{template type|"
"non-type template|template template}0 parameter%select{ pack|}1">;
def note_template_parameter_pack_non_pack : Note<
"%select{template type|non-type template|template template}0 parameter"
"%select{| pack}1 does not match %select{template type|non-type template"
"|template template}0 parameter%select{ pack|}1 in template argument">;
def note_template_parameter_pack_here : Note<
"previous %select{template type|non-type template|template template}0 "
"parameter%select{| pack}1 declared here">;
def err_unexpanded_parameter_pack : Error<
"%select{expression|base type|declaration type|data member type|bit-field "
"size|static assertion|fixed underlying type|enumerator value|"
"using declaration|friend declaration|qualifier|initializer|default argument|"
"non-type template parameter type|exception type|partial specialization|"
"__if_exists name|__if_not_exists name|lambda|block}0 contains"
"%plural{0: an|:}1 unexpanded parameter pack"
"%plural{0:|1: %2|2:s %2 and %3|:s %2, %3, ...}1">;
def err_pack_expansion_without_parameter_packs : Error<
"pack expansion does not contain any unexpanded parameter packs">;
def err_pack_expansion_length_conflict : Error<
"pack expansion contains parameter packs %0 and %1 that have different "
"lengths (%2 vs. %3)">;
def err_pack_expansion_length_conflict_multilevel : Error<
"pack expansion contains parameter pack %0 that has a different "
"length (%1 vs. %2) from outer parameter packs">;
def err_pack_expansion_member_init : Error<
"pack expansion for initialization of member %0">;
def err_function_parameter_pack_without_parameter_packs : Error<
"type %0 of function parameter pack does not contain any unexpanded "
"parameter packs">;
def err_ellipsis_in_declarator_not_parameter : Error<
"only function and template parameters can be parameter packs">;
def err_sizeof_pack_no_pack_name : Error<
"%0 does not refer to the name of a parameter pack">;
def err_fold_expression_packs_both_sides : Error<
"binary fold expression has unexpanded parameter packs in both operands">;
def err_fold_expression_empty : Error<
"unary fold expression has empty expansion for operator '%0' "
"with no fallback value">;
def err_fold_expression_bad_operand : Error<
"expression not permitted as operand of fold expression">;
def err_unexpected_typedef : Error<
"unexpected type name %0: expected expression">;
def err_unexpected_namespace : Error<
"unexpected namespace name %0: expected expression">;
def err_undeclared_var_use : Error<"use of undeclared identifier %0">;
def ext_undeclared_unqual_id_with_dependent_base : ExtWarn<
"use of undeclared identifier %0; "
"unqualified lookup into dependent bases of class template %1 is a Microsoft extension">,
InGroup<Microsoft>;
def ext_found_via_dependent_bases_lookup : ExtWarn<"use of identifier %0 "
"found via unqualified lookup into dependent bases of class templates is a "
"Microsoft extension">, InGroup<Microsoft>;
def note_dependent_var_use : Note<"must qualify identifier to find this "
"declaration in dependent base class">;
def err_not_found_by_two_phase_lookup : Error<"call to function %0 that is neither "
"visible in the template definition nor found by argument-dependent lookup">;
def note_not_found_by_two_phase_lookup : Note<"%0 should be declared prior to the "
"call site%select{| or in %2| or in an associated namespace of one of its arguments}1">;
def err_undeclared_use : Error<"use of undeclared %0">;
def warn_partial_availability : Warning<"%0 is only available conditionally">,
InGroup<PartialAvailability>, DefaultIgnore;
def note_partial_availability_silence : Note<
"explicitly redeclare %0 to silence this warning">;
def warn_partial_message : Warning<"%0 is partial: %1">,
InGroup<PartialAvailability>, DefaultIgnore;
def warn_partial_fwdclass_message : Warning<
"%0 may be partial because the receiver type is unknown">,
InGroup<PartialAvailability>, DefaultIgnore;
def warn_deprecated : Warning<"%0 is deprecated">,
InGroup<DeprecatedDeclarations>;
def warn_property_method_deprecated :
Warning<"property access is using %0 method which is deprecated">,
InGroup<DeprecatedDeclarations>;
def warn_deprecated_message : Warning<"%0 is deprecated: %1">,
InGroup<DeprecatedDeclarations>;
def warn_deprecated_anonymous_namespace : Warning<
"'deprecated' attribute on anonymous namespace ignored">,
InGroup<IgnoredAttributes>;
def warn_deprecated_fwdclass_message : Warning<
"%0 may be deprecated because the receiver type is unknown">,
InGroup<DeprecatedDeclarations>;
def warn_deprecated_def : Warning<
"Implementing deprecated %select{method|class|category}0">,
InGroup<DeprecatedImplementations>, DefaultIgnore;
def err_unavailable : Error<"%0 is unavailable">;
def err_property_method_unavailable :
Error<"property access is using %0 method which is unavailable">;
def err_unavailable_message : Error<"%0 is unavailable: %1">;
def warn_unavailable_fwdclass_message : Warning<
"%0 may be unavailable because the receiver type is unknown">,
InGroup<UnavailableDeclarations>;
def note_availability_specified_here : Note<
"%0 has been explicitly marked "
"%select{unavailable|deleted|deprecated|partial}1 here">;
def note_implicitly_deleted : Note<
"explicitly defaulted function was implicitly deleted here">;
def note_inherited_deleted_here : Note<
"deleted constructor was inherited here">;
def note_cannot_inherit : Note<
"constructor cannot be inherited">;
def warn_not_enough_argument : Warning<
"not enough variable arguments in %0 declaration to fit a sentinel">,
InGroup<Sentinel>;
def warn_missing_sentinel : Warning <
"missing sentinel in %select{function call|method dispatch|block call}0">,
InGroup<Sentinel>;
def note_sentinel_here : Note<
"%select{function|method|block}0 has been explicitly marked sentinel here">;
def warn_missing_prototype : Warning<
"no previous prototype for function %0">,
InGroup<DiagGroup<"missing-prototypes">>, DefaultIgnore;
def note_declaration_not_a_prototype : Note<
"this declaration is not a prototype; add 'void' to make it a prototype for a zero-parameter function">;
def warn_missing_variable_declarations : Warning<
"no previous extern declaration for non-static variable %0">,
InGroup<DiagGroup<"missing-variable-declarations">>, DefaultIgnore;
def err_static_data_member_reinitialization :
Error<"static data member %0 already has an initializer">;
def err_redefinition : Error<"redefinition of %0">;
def err_alias_after_tentative :
Error<"alias definition of %0 after tentative definition">;
def err_alias_is_definition :
Error<"definition %0 cannot also be an alias">;
def err_definition_of_implicitly_declared_member : Error<
"definition of implicitly declared %select{default constructor|copy "
"constructor|move constructor|copy assignment operator|move assignment "
"operator|destructor|function}1">;
def err_definition_of_explicitly_defaulted_member : Error<
"definition of explicitly defaulted %select{default constructor|copy "
"constructor|move constructor|copy assignment operator|move assignment "
"operator|destructor}0">;
def err_redefinition_extern_inline : Error<
"redefinition of a 'extern inline' function %0 is not supported in "
"%select{C99 mode|C++}1">;
def note_deleted_dtor_no_operator_delete : Note<
"virtual destructor requires an unambiguous, accessible 'operator delete'">;
def note_deleted_special_member_class_subobject : Note<
"%select{default constructor|copy constructor|move constructor|"
"copy assignment operator|move assignment operator|destructor}0 of "
"%1 is implicitly deleted because "
"%select{base class %3|%select{||||variant }4field %3}2 has "
"%select{no|a deleted|multiple|an inaccessible|a non-trivial}4 "
"%select{%select{default constructor|copy constructor|move constructor|copy "
"assignment operator|move assignment operator|destructor}0|destructor}5"
"%select{||s||}4">;
def note_deleted_default_ctor_uninit_field : Note<
"default constructor of %0 is implicitly deleted because field %1 of "
"%select{reference|const-qualified}3 type %2 would not be initialized">;
def note_deleted_default_ctor_all_const : Note<
"default constructor of %0 is implicitly deleted because all "
"%select{data members|data members of an anonymous union member}1"
" are const-qualified">;
def note_deleted_copy_ctor_rvalue_reference : Note<
"copy constructor of %0 is implicitly deleted because field %1 is of "
"rvalue reference type %2">;
def note_deleted_copy_user_declared_move : Note<
"copy %select{constructor|assignment operator}0 is implicitly deleted because"
" %1 has a user-declared move %select{constructor|assignment operator}2">;
def note_deleted_assign_field : Note<
"%select{copy|move}0 assignment operator of %1 is implicitly deleted "
"because field %2 is of %select{reference|const-qualified}4 type %3">;
// These should be errors.
def warn_undefined_internal : Warning<
"%select{function|variable}0 %q1 has internal linkage but is not defined">,
InGroup<DiagGroup<"undefined-internal">>;
def warn_undefined_inline : Warning<"inline function %q0 is not defined">,
InGroup<DiagGroup<"undefined-inline">>;
def note_used_here : Note<"used here">;
def ext_internal_in_extern_inline : ExtWarn<
"static %select{function|variable}0 %1 is used in an inline function with "
"external linkage">, InGroup<StaticInInline>;
def ext_internal_in_extern_inline_quiet : Extension<
"static %select{function|variable}0 %1 is used in an inline function with "
"external linkage">, InGroup<StaticInInline>;
def warn_static_local_in_extern_inline : Warning<
"non-constant static local variable in inline function may be different "
"in different files">, InGroup<StaticLocalInInline>;
def note_convert_inline_to_static : Note<
"use 'static' to give inline function %0 internal linkage">;
def ext_redefinition_of_typedef : ExtWarn<
"redefinition of typedef %0 is a C11 feature">,
InGroup<DiagGroup<"typedef-redefinition"> >;
def err_redefinition_variably_modified_typedef : Error<
"redefinition of %select{typedef|type alias}0 for variably-modified type %1">;
def err_inline_decl_follows_def : Error<
"inline declaration of %0 follows non-inline definition">;
def err_inline_declaration_block_scope : Error<
"inline declaration of %0 not allowed in block scope">;
def err_static_non_static : Error<
"static declaration of %0 follows non-static declaration">;
def err_different_language_linkage : Error<
"declaration of %0 has a different language linkage">;
def ext_retained_language_linkage : Extension<
"friend function %0 retaining previous language linkage is an extension">,
InGroup<DiagGroup<"retained-language-linkage">>;
def err_extern_c_global_conflict : Error<
"declaration of %1 %select{with C language linkage|in global scope}0 "
"conflicts with declaration %select{in global scope|with C language linkage}0">;
def note_extern_c_global_conflict : Note<
"declared %select{in global scope|with C language linkage}0 here">;
def warn_weak_import : Warning <
"an already-declared variable is made a weak_import declaration %0">;
def ext_static_non_static : Extension<
"redeclaring non-static %0 as static is a Microsoft extension">, InGroup<Microsoft>;
def err_non_static_static : Error<
"non-static declaration of %0 follows static declaration">;
def err_extern_non_extern : Error<
"extern declaration of %0 follows non-extern declaration">;
def err_non_extern_extern : Error<
"non-extern declaration of %0 follows extern declaration">;
def err_non_thread_thread : Error<
"non-thread-local declaration of %0 follows thread-local declaration">;
def err_thread_non_thread : Error<
"thread-local declaration of %0 follows non-thread-local declaration">;
def err_thread_thread_different_kind : Error<
"thread-local declaration of %0 with %select{static|dynamic}1 initialization "
"follows declaration with %select{dynamic|static}1 initialization">;
def err_redefinition_different_type : Error<