[PATCH] Unknown-bound array static data member of template should be type dependent

Richard Smith richard at metafoo.co.uk
Tue Nov 12 23:09:07 PST 2013



================
Comment at: lib/AST/Expr.cpp:317
@@ -316,1 +316,3 @@
       InstantiationDependent = true;
+      TypeSourceInfo *TInfo = Var->getTypeSourceInfo();
+      if (TInfo->getType()->isIncompleteArrayType())
----------------
You should get the `TypeSourceInfo` from `Var->getFirstDecl()` here, in case we manage to build a `DeclRefExpr` referring to the definition of the static data member. Testcase:

  template<typename T> struct S {
    static int arr[];
    void f();
  };
  template<typename T> int S<T>::arr[1];
  template<typename T> void S<T>::f() {
    static_assert(sizeof(arr) != sizeof(int), "");
  }
  template<> int S<int>::arr[2];
  template void S<int>::f();


http://llvm-reviews.chandlerc.com/D2049



More information about the cfe-commits mailing list