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

[complex.numbers.general] Is the effect of instantiating complex<NonFP> unspecified even if the specialization is program-defined? #7270

Open
frederick-vs-ja opened this issue Sep 28, 2024 · 5 comments · May be fixed by #7271

Comments

@frederick-vs-ja
Copy link
Contributor

[complex.numbers.general]/2 currently states:

The effect of instantiating the template complex for any type that is not a cv-unqualified floating-point type ([basic.fundamental]) is unspecified.

Does this only cover the primary template, or even cover program-defined specializations? If the intent was the latter, I don't know how can this be correct due to the core language rules.

However, free functions in <complex> are unlikely to work for program-defined complex specializations, which is a possible cause the current specification.

@jensmaurer
Copy link
Member

Using a program-defined specialization does not "instantiate the template" definition std::complex provided by the standard library.

I'm not seeing anything editorial here.

@frederick-vs-ja
Copy link
Contributor Author

Using a program-defined specialization does not "instantiate the template" definition std::complex provided by the standard library.

Thanks. Should we clarify that [complex.numbers.general]/2 is restricted to the primary template of complex or leave the current wording as-is?

@jensmaurer
Copy link
Member

It says "the template", not "a template named std::complex, so I'm not sure what clarification you seek. Are you talking about explicit specializations or partial specializations, by the way? The former are not templates.

@frederick-vs-ja
Copy link
Contributor Author

It says "the template", not "a template named std::complex, so I'm not sure what clarification you seek.

I think the difference is somehow obscure if we just say "the template complex" (only the primary template) and "a template named std::complex“ (including program-defined partial specializations). Perhaps it would be clearer to say "the primary template of complex", which shouldn't change the meaning.

@jwakely
Copy link
Member

jwakely commented Sep 28, 2024

Perhaps it would be clearer to say "the primary template of complex", which shouldn't change the meaning.

That seems reasonable to me.

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 a pull request may close this issue.

3 participants