Skip to content

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

Closed
@timsong-cpp

Description

@timsong-cpp
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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @timsong-cpp@jensmaurer

      Issue actions

        [dcl.fct.def.delete] questionable example in p3 · Issue #1925 · cplusplus/draft