Skip to content

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

@timsong-cpp

Description

@timsong-cpp

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.

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

Issue actions