if (S.getLangOpts().CPlusPlus11 && Entity.getType()->isReferenceType() &&
Args.size() == 1 && isa<InitListExpr>(Args[0]) &&
+ cast<InitListExpr>(Args[0])->getNumInits() == 1 &&
Entity.getKind() != InitializedEntity::EK_Parameter) {
// Produce a C++98 compatibility warning if we are initializing a reference
// from an initializer list. For parameters, we produce a better warning
initializer_list(T*, size_t);
T *p;
size_t n;
+ T *begin();
+ T *end();
};
}
int xs[] = {1, 2, 3};
for (int &a : xs) { // expected-warning {{range-based for loop is incompatible with C++98}}
}
+ for (auto &b : {1, 2, 3}) {
+ // expected-warning@-1 {{range-based for loop is incompatible with C++98}}
+ // expected-warning@-2 {{'auto' type specifier is incompatible with C++98}}
+ // expected-warning@-3 {{initialization of initializer_list object is incompatible with C++98}}
+ }
}
struct InClassInit {