r229353 - DR1467: If aggregate initialization encounters an initializer list for which

Richard Smith richard-llvm at metafoo.co.uk
Sun Feb 15 20:42:59 PST 2015


Author: rsmith
Date: Sun Feb 15 22:42:59 2015
New Revision: 229353

URL: http://llvm.org/viewvc/llvm-project?rev=229353&view=rev
Log:
DR1467: If aggregate initialization encounters an initializer list for which
subobject initialization is not possible, be sure to note the overall
initialization as having failed so that overload resolution knows that the
relevant candidate is not viable.

Modified:
    cfe/trunk/lib/Sema/SemaInit.cpp
    cfe/trunk/test/CXX/drs/dr14xx.cpp

Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=229353&r1=229352&r2=229353&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Sun Feb 15 22:42:59 2015
@@ -1015,7 +1015,8 @@ void InitListChecker::CheckSubElementTyp
 
         UpdateStructuredListElement(StructuredList, StructuredIndex,
                                     Result.getAs<Expr>());
-      }
+      } else if (!Seq)
+        hadError = true;
       ++Index;
       return;
     }

Modified: cfe/trunk/test/CXX/drs/dr14xx.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/drs/dr14xx.cpp?rev=229353&r1=229352&r2=229353&view=diff
==============================================================================
--- cfe/trunk/test/CXX/drs/dr14xx.cpp (original)
+++ cfe/trunk/test/CXX/drs/dr14xx.cpp Sun Feb 15 22:42:59 2015
@@ -327,6 +327,13 @@ namespace dr1467 {  // dr1467: 3.7 c++11
 
   struct NestedInit { int a, b, c; };
   NestedInit ni[1] = {{NestedInit{1, 2, 3}}};
+
+  namespace NestedInit2 {
+    struct Pair { int a, b; };
+    struct TwoPairs { TwoPairs(Pair, Pair); };
+    struct Value { Value(Pair); Value(TwoPairs); };
+    void f() { Value{{{1,2},{3,4}}}; }
+  }
 } // dr1467
 
 namespace dr1490 {  // dr1490: 3.7 c++11





More information about the cfe-commits mailing list