[cfe-commits] r173540 - Revert r172285 (suppressing a 'redundant' -Wc++98-compat warning) and add a

Richard Smith richard-llvm at metafoo.co.uk
Fri Jan 25 16:39:02 PST 2013


Author: rsmith
Date: Fri Jan 25 18:39:02 2013
New Revision: 173540

URL: http://llvm.org/viewvc/llvm-project?rev=173540&view=rev
Log:
Revert r172285 (suppressing a 'redundant' -Wc++98-compat warning) and add a
testcase for a situation it caused us to miss.

Modified:
    cfe/trunk/lib/Sema/SemaInit.cpp
    cfe/trunk/test/SemaCXX/cxx98-compat.cpp

Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=173540&r1=173539&r2=173540&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Fri Jan 25 18:39:02 2013
@@ -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

Modified: cfe/trunk/test/SemaCXX/cxx98-compat.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx98-compat.cpp?rev=173540&r1=173539&r2=173540&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/cxx98-compat.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx98-compat.cpp Fri Jan 25 18:39:02 2013
@@ -109,7 +109,9 @@ void RangeFor() {
   // expected-warning at -1 {{range-based for loop is incompatible with C++98}}
   // expected-warning at -2 {{'auto' type specifier is incompatible with C++98}}
   // expected-warning at -3 {{initialization of initializer_list object is incompatible with C++98}}
+  // expected-warning at -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 {





More information about the cfe-commits mailing list