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

Douglas Gregor dgregor at apple.com
Sun Mar 4 19:52:49 PST 2012


On Mar 3, 2012, at 4:03 AM, Rafael EspĂ­ndola wrote:

> 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.

This LGTM.

	- Doug



More information about the cfe-commits mailing list