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.fct.def.delete] questionable example in p3 #1925

Closed
timsong-cpp opened this issue Feb 15, 2018 · 0 comments
Closed

[dcl.fct.def.delete] questionable example in p3 #1925

timsong-cpp opened this issue Feb 15, 2018 · 0 comments
Assignees

Comments

@timsong-cpp
Copy link
Contributor

One can enforce non-default-initialization and non-integral initialization with

 struct onlydouble {
   onlydouble() = delete;                // OK, but redundant
   onlydouble(std::intmax_t) = delete;
   onlydouble(double);
 };

This enforces "non-integral initialization" only in the sense of causing an ambiguity in overload resolution in most cases, rather than through the "honeypot" behavior of deleted functions. This is also a poor way to enforce non-integral initialization, since the same ambiguity also blocks initialization with long double.

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

2 participants