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

[dcl.dcl] Replace 'could' and 'might' #4362

Merged
merged 1 commit into from Nov 13, 2020
Merged

Conversation

jensmaurer
Copy link
Member

as directed by ISO/CS.

Partially addresses #4319

@@ -927,7 +927,7 @@
For a constexpr function or constexpr constructor
that is neither defaulted nor a template,
if no argument values exist such that
an invocation of the function or constructor could be an evaluated subexpression of a core
an invocation of the function or constructor would be an evaluated subexpression of a core
Copy link
Member

Choose a reason for hiding this comment

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

I find this very hard to understand with "would" here. I think part of the problem is that the original wording is unclear. What we mean is:

"For a constexpr function or constexpr constructor that is neither defaulted nor a template, if there does not exist a valid core constant expression whose evaluation would evaluate an invocation of the function or constructor, and, for a constructor, there does not exist a valid declaration of a constant-initialized variable whose evaluation would evaluate an invocation of the function or constructor."

That is, this is really "for all possible core constant expressions", not "for all possible argument values".

I think we can simplify and clarify that:

"A constexpr function that is neither defaulted nor a template is ill-formed, no diagnostic required, if it is not possible for an evaluation of an invocation of the function to be performed while evaluating any valid manifestly constant-evaluated expression."

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

source/declarations.tex Outdated Show resolved Hide resolved
source/declarations.tex Outdated Show resolved Hide resolved
source/declarations.tex Outdated Show resolved Hide resolved
char c1 = x; // OK, though it might narrow (in this case, it does narrow)
char c2{x}; // error: might narrow
char c1 = x; // OK, though it can narrow (in this case, it does narrow)
char c2{x}; // error: can narrow
Copy link
Member

Choose a reason for hiding this comment

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

I don't think "can" makes sense here, because the code is ill-formed, so it can't do anything. How about "error: potentially narrows"?

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@@ -5878,7 +5878,7 @@
signed int si1 =
{ (unsigned int)-1 }; // error: narrows
int ii = {2.0}; // error: narrows
float f1 { x }; // error: might narrow
float f1 { x }; // error: can narrow
Copy link
Member

Choose a reason for hiding this comment

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

Likewise.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@@ -8793,7 +8793,7 @@
Function \tcode{g}'s second parameter has a \tcode{carries_dependency} attribute,
but its first parameter does not. Therefore, function \tcode{h}'s first call to
\tcode{g} carries a dependency into \tcode{g}, but its second call does not. The
implementation might need to insert a fence prior to the second call to
implementation can be required to insert a fence prior to the second call to
Copy link
Member

Choose a reason for hiding this comment

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

"can be required" sounds like the programmer can cause the implementation to be required to do this, which isn't really right. This solves that problem but I'm still not overjoyed by it:

Suggested change
implementation can be required to insert a fence prior to the second call to
implementation can need to insert a fence prior to the second call to

Copy link
Member Author

Choose a reason for hiding this comment

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

"can need"?

ugh

"It is possible that the implementation needs to insert a fence..."

source/declarations.tex Outdated Show resolved Hide resolved
@jensmaurer
Copy link
Member Author

applied, squashed, and force-pushed

@zygoloid zygoloid merged commit 389a230 into cplusplus:c++20 Nov 13, 2020
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.

None yet

3 participants