Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think the answer is "no" and it's going to stay that way. </p> <p>Types only have names the linker sees when they appear in function parameters or template arguments (some other oddballs? maybe). Your example is actually one of the easier cases, and to detect that the linker would have to be working with an ABI that (in effect) marks template arguments supplied by a specialization. But they can't do that: you have to be able to pass a pointer to a templated struct without knowing whether it's pointing to a specialization.</p> <p>Even then, you can't get much more radical than even trivial ABI changes, it means at least considering whether you need to recompile and/or relink every library and executable. If your structs were members <code>struct trojan { A&lt;int&gt; greeks; }</code> you'd have identical type names anyway, and if they never appeared as function parameters or template arguments the linker would never see them even if they were different.</p> <p>To get automatic detection I'd start with an approachable OSS C++ frontend like clang. You'll need (non-standard) name-mangling rules that do mark template-specialization-argument names and make it generate sideband lists of all template declarations it finds references to. Then write a separate tool that looks at the lists for all the objects that are being linked together and complains if it finds a name+arguments used (not just referenced or declared) in one object that's also used in another but from a different specialization.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload