testcase for a situation it caused us to miss.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173540
91177308-0d34-0410-b5e6-
96231b3b80d8
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
// 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}}
+ // expected-warning@-4 {{reference initialized from initializer list is incompatible with C++98}}
}
+ struct Agg { int a, b; } const &agg = { 1, 2 }; // expected-warning {{reference initialized from initializer list is incompatible with C++98}}
}
struct InClassInit {