r196558 - PR18152: When computing the semantic form for an initializer list, keep track

Richard Smith richard-llvm at metafoo.co.uk
Thu Dec 5 17:27:24 PST 2013


Author: rsmith
Date: Thu Dec  5 19:27:24 2013
New Revision: 196558

URL: http://llvm.org/viewvc/llvm-project?rev=196558&view=rev
Log:
PR18152: When computing the semantic form for an initializer list, keep track
of whether the initializer list is dependent.

Modified:
    cfe/trunk/include/clang/AST/Expr.h
    cfe/trunk/lib/AST/Expr.cpp
    cfe/trunk/test/SemaTemplate/dependent-expr.cpp

Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=196558&r1=196557&r2=196558&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Thu Dec  5 19:27:24 2013
@@ -3774,6 +3774,14 @@ public:
   void setInit(unsigned Init, Expr *expr) {
     assert(Init < getNumInits() && "Initializer access out of range!");
     InitExprs[Init] = expr;
+
+    if (expr) {
+      ExprBits.TypeDependent |= expr->isTypeDependent();
+      ExprBits.ValueDependent |= expr->isValueDependent();
+      ExprBits.InstantiationDependent |= expr->isInstantiationDependent();
+      ExprBits.ContainsUnexpandedParameterPack |=
+          expr->containsUnexpandedParameterPack();
+    }
   }
 
   /// \brief Reserve space for some number of initializers.

Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=196558&r1=196557&r2=196558&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Thu Dec  5 19:27:24 2013
@@ -1867,12 +1867,12 @@ void InitListExpr::resizeInits(const AST
 Expr *InitListExpr::updateInit(const ASTContext &C, unsigned Init, Expr *expr) {
   if (Init >= InitExprs.size()) {
     InitExprs.insert(C, InitExprs.end(), Init - InitExprs.size() + 1, 0);
-    InitExprs.back() = expr;
+    setInit(Init, expr);
     return 0;
   }
 
   Expr *Result = cast_or_null<Expr>(InitExprs[Init]);
-  InitExprs[Init] = expr;
+  setInit(Init, expr);
   return Result;
 }
 

Modified: cfe/trunk/test/SemaTemplate/dependent-expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/dependent-expr.cpp?rev=196558&r1=196557&r2=196558&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/dependent-expr.cpp (original)
+++ cfe/trunk/test/SemaTemplate/dependent-expr.cpp Thu Dec  5 19:27:24 2013
@@ -93,3 +93,10 @@ namespace PR10837 {
   }
   template struct A<int>;
 }
+
+namespace PR18152 {
+  template<int N> struct A {
+    static const int n = {N};
+  };
+  template struct A<0>;
+}





More information about the cfe-commits mailing list