[cfe-commits] [patch][pr12104] Mark a decl as needed when we see a explicit template definition

Rafael EspĂ­ndola rafael.espindola at gmail.com
Sat Mar 3 04:03:42 PST 2012


I think I found out what is going on in pr12104. It is a mismatch from
Sema and CodeGen's views of what is needed. In the testcase:

template <int dimm> struct Patch {
  static const unsigned int no_neighbor = -1;
};
template <int dim>
const unsigned int Patch<dim>::no_neighbor;
void f(int);
void g() {
  f(Patch<1>::no_neighbor);
}
template struct Patch<1>;

Sema logic is that we already have a definition because of the out of
line decl. CodeGen's logic is that this is a decl that can be
deferred, but it never sees anything that forces it to emit it. This
patch adds a method to be called when we see an explicit template
instantiation definition.

Cheers,
Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.patch
Type: application/octet-stream
Size: 6026 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120303/c9bb9cf4/attachment.obj>


More information about the cfe-commits mailing list