Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[basic.def.odr] How is a default argument considered as a definition? #5458

Open
xmh0511 opened this issue May 10, 2022 · 0 comments
Open

[basic.def.odr] How is a default argument considered as a definition? #5458

xmh0511 opened this issue May 10, 2022 · 0 comments

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented May 10, 2022

[basic.def.odr] p1 says

Each of the following is termed a definable item:

  • [...]
  • a default argument for a parameter (for a function in a given scope) ([dcl.fct.default]), or

Then [basic.def.odr] p14 says

For any definable item D with definitions in multiple translation units,

  • [...]
  • if the definitions in different translation units do not satisfy the following requirements,

This obviously implies that a default argument is considered as a definition(also a declaration). But [basic.def] says

Each entity declared by a declaration is also defined by that declaration unless:

  • [...]

First, the italic declaration cross-references to subclause [dcl.pre], which didn't give a grammar meaning that is a declaration for the default argument, let alone how could it be a definition?

We lack a clarification for the default arguments that appear in non-template functions, which may have the similar manner as [temp.decls.general] p3 did

For purposes of name lookup and instantiation, default arguments, type-constraints, requires-clauses ([temp.pre]), and noexcept-specifiers of function templates and of member functions of class templates are considered definitions;

Might it be?

The default arguments of a function that is not templated are considered definitions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant