diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-01-26 00:39:02 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-01-26 00:39:02 +0000 |
commit | 25cf8abf30189323199b1424848b105940267c1b (patch) | |
tree | c6499d59a34dc68b51fb0b7cc2171850705ee39f | |
parent | 10442564e1ba3c4dfb184cc4e36beffbee4811c3 (diff) |
Revert r172285 (suppressing a 'redundant' -Wc++98-compat warning) and add a
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
-rw-r--r-- | lib/Sema/SemaInit.cpp | 1 | ||||
-rw-r--r-- | test/SemaCXX/cxx98-compat.cpp | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index e661110832..c3d612b732 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -4914,7 +4914,6 @@ InitializationSequence::Perform(Sema &S, 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 diff --git a/test/SemaCXX/cxx98-compat.cpp b/test/SemaCXX/cxx98-compat.cpp index ca32c197de..7d36770f5d 100644 --- a/test/SemaCXX/cxx98-compat.cpp +++ b/test/SemaCXX/cxx98-compat.cpp @@ -109,7 +109,9 @@ void RangeFor() { // 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 { |