we didn't explicitly specify that the current instantiation does not cause an implicit instantiation
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 221
- Forks
- 813
- Avg merge
- 16h 4m
- Merged PRs (30d)
- 36
Description
[temp.inst] p16
There is an implementation-defined quantity that specifies the limit on the total depth of recursive instantiations ([implimits]), which could involve more than one template. The result of an infinite recursion in instantiation is undefined.
has an example that:
template<class T> class X {
X<T>* p; // #1 // OK
X<T*> a; // #2 // implicit generation of X<T> requires
// the implicit instantiation of X<T*> which requires
// the implicit instantiation of X<T**> which …
// an extra example
explicit(sizeof(X<T>)>1) operator int(){ // #3
return 0;
}
};
In either case of the three, the injected-class-name X is used as a template-name as per [temp.local] p1. That means, all the use of X can be replaced by ::X. [temp.inst] p2 states that
Unless a class template specialization is a declared specialization, the class template specialization is implicitly instantiated when the specialization is referenced in a context that requires a completely-defined object type or when the completeness of the class type affects the semantics of the program.
The operand of sizeof requires the operand to have a completely-defined object type and the class template specialization X<T> is not a declared specialization, thus, that operand should cause the implicit instantiation of X<T>, the implicit instantiation for X<T>, in turn, causes the implicit instantiation of explicit(sizeof(X<T>)>1) , which process is recursive.
We do not have a sufficient reason that can interpret why the current instantiation won't cause that non-reasonable instantiation that would violate [temp.inst] p16.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading [temp.inst] paragraphs 2 and 16 alongside [temp.local] paragraph 1 and the referenced [implimits] wording. Determine how the current-instantiation example interacts with implicit instantiation, then clarify the draft so the intended non-recursive behavior is explicit and the interpretation is resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, tex
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100