[basic.def.odr] lambda-expression example seemingly constradicts normative wording
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 221
- Forks
- 813
- Avg merge
- 16h 4m
- Merged PRs (30d)
- 36
Description
On one hand, lambda-expressions in default arguments are not required to have the same closure type:
In each such definition, except within the default arguments and default template arguments of D, corresponding lambda-expressions shall have the same closure type (see below).
http://eel.is/c++draft/basic.def.odr#14.6
On the other hand, the example shows the opposite:
inline void g(bool cond, void (*p)() = []{}) {
if (cond) g(false);
}
If the definition of g appears in multiple translation units, the program is ill-formed (no diagnostic required) because each such definition uses a default argument that refers to a distinct lambda-expression closure type.
http://eel.is/c++draft/basic.def.odr#16
I can't make sense of it; it seems like a direct contradiction to me.
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 comparing the linked [basic.def.odr] paragraphs with the lambda-expression wording and the g example. Determine whether the apparent conflict is resolved by context or requires a standards-draft clarification; done means the normative text and example no longer appear contradictory.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100