[PATCH] Instantiate incomplete class used in template method.

Richard Smith richard at metafoo.co.uk
Sun Apr 5 17:16:17 PDT 2015


Please add a testcase that uses a forward declaration and then defines it, such as:

  template<typename T> void f() {
    void g(struct x);
    struct x {};
  }
  template void f<int>();

I think a case like that will still assert with your current patch (because `x` is not an incomplete type, but it won't have had a declaration instantiated when we instantiate the declaration of `g`).


================
Comment at: lib/Sema/SemaTemplateInstantiate.cpp:2802
@@ +2801,3 @@
+  if (const TagDecl *TD = dyn_cast<TagDecl>(D))
+    if (TD->getTypeForDecl()->isIncompleteType())
+      return nullptr;
----------------
This should use the same condition as the other change.

http://reviews.llvm.org/D8281

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list