[cfe-commits] r150928 - in /cfe/trunk/lib: AST/ExprConstant.cpp CodeGen/CGExprConstant.cpp

Sebastian Redl sebastian.redl at getdesigned.at
Sun Feb 19 06:53:49 PST 2012


Author: cornedbee
Date: Sun Feb 19 08:53:49 2012
New Revision: 150928

URL: http://llvm.org/viewvc/llvm-project?rev=150928&view=rev
Log:
Refuse to compile global std::initializer_lists instead of doing completely the wrong thing.

Modified:
    cfe/trunk/lib/AST/ExprConstant.cpp
    cfe/trunk/lib/CodeGen/CGExprConstant.cpp

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=150928&r1=150927&r2=150928&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Sun Feb 19 08:53:49 2012
@@ -3513,6 +3513,10 @@
 }
 
 bool RecordExprEvaluator::VisitInitListExpr(const InitListExpr *E) {
+  // Cannot constant-evaluate std::initializer_list inits.
+  if (E->initializesStdInitializerList())
+    return false;
+
   const RecordDecl *RD = E->getType()->castAs<RecordType>()->getDecl();
   const ASTRecordLayout &Layout = Info.Ctx.getASTRecordLayout(RD);
 

Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp?rev=150928&r1=150927&r2=150928&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Sun Feb 19 08:53:49 2012
@@ -339,6 +339,11 @@
 }
                             
 bool ConstStructBuilder::Build(InitListExpr *ILE) {
+  if (ILE->initializesStdInitializerList()) {
+    CGM.ErrorUnsupported(ILE, "global std::initializer_list");
+    return false;
+  }
+
   RecordDecl *RD = ILE->getType()->getAs<RecordType>()->getDecl();
   const ASTRecordLayout &Layout = CGM.getContext().getASTRecordLayout(RD);
 





More information about the cfe-commits mailing list