Skip to content

[basic.def] Fix note -- declarations cannot be empty#8405

Closed
AlisdairM wants to merge 1 commit into
cplusplus:mainfrom
AlisdairM:noted_declarations_cannot_be_empty
Closed

[basic.def] Fix note -- declarations cannot be empty#8405
AlisdairM wants to merge 1 commit into
cplusplus:mainfrom
AlisdairM:noted_declarations_cannot_be_empty

Conversation

@AlisdairM

Copy link
Copy Markdown
Contributor

As noted during CWG review of another issue.

As noted during CWG review of another issue.
jensmaurer
jensmaurer previously approved these changes Nov 4, 2025

@jensmaurer jensmaurer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. A (prose-font) "declaration" is never an empty-declaration. (see below)

@lprv

lprv commented Nov 4, 2025

Copy link
Copy Markdown
Contributor

Why not? An empty-declaration can appear as a name-declaration or a member-declaration, both of which are included in the definition of "declaration" given by [basic.pre]/5.

@jensmaurer

Copy link
Copy Markdown
Member

Indeed.

@jensmaurer jensmaurer requested review from jensmaurer and removed request for jensmaurer November 5, 2025 12:28
@jensmaurer

Copy link
Copy Markdown
Member

@AlisdairM , please re-assess.

@AlisdairM

Copy link
Copy Markdown
Contributor Author

Reviewing the text again, the note is attached to a sentence that starts:
"A declaration of an entity X ...". The whole paragraph is clearly talking about declarations of entities, and empty declarations do not declare entities. The note is not super precise, allowing the reader to infer that by "declaration" we mean the set of declarations of the preceding sentence. Likewise, the list does not claim to be complete. I believe the initial CWG reaction was correct, and this note would be clearer without the deleted bullet.

@eisenwave

Copy link
Copy Markdown
Member

It's not clear to me whether the note is only attached to the last sentence or the paragraph as a whole. The paragraph starts with

A declaration ([basic.pre]) may (re)introduce one or more names and/or entities into a translation unit.

Emphasis on "may". It doesn't necessarily do so (and in the case of an empty-declaration, which is a "declaration", it does not. Everything makes sense to me.

The last bullet (which you're not deleting) says

use of attributes ([dcl.attr]).

This presumably refers to [[fallthrough]]; and [[assume(true)]];, both of which are an attribute-declaration, which also doesn't declare any entity. It's basically an empty-declaration with some attributes slapped onto it. Why should this bullet stay then, if it also doesn't talk about entities?

@AlisdairM

AlisdairM commented Nov 14, 2025

Copy link
Copy Markdown
Contributor Author

Withdrawing.

After a more carefully re-reading I agree with Jan. Everything in that list is about not declaring a name, the complement to the normative sentence.

@AlisdairM AlisdairM closed this Nov 14, 2025
@AlisdairM AlisdairM deleted the noted_declarations_cannot_be_empty branch November 14, 2025 19:09
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

Successfully merging this pull request may close these issues.

5 participants