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

[unique.ptr.single.ctor] Sloppy wording after application of LWG 2905 #1530

Closed
timsong-cpp opened this issue Mar 10, 2017 · 5 comments
Closed
Assignees

Comments

@timsong-cpp
Copy link
Contributor

After LWG 2905 (part of Kona 2017 LWG motion 20) is applied, we will have something along the lines of

If D is an lvalue reference type A&, then the signatures are:

unique_ptr(pointer p, A& d) noexcept;
unique_ptr(pointer p, A&& d) = delete;

The use of signature is incorrect, as whether a function is defined as deleted or not is not part of the signature. See [defns.signature.member].

The paragraph dealing with the case where D is const A& will also have the same problem.

@jwakely
Copy link
Member

jwakely commented Mar 10, 2017

In LWG 2905 I pointed out that we could replace the see below stuff with the real signatures:

unique_ptr(pointer p, const D& d) noexcept;
unique_ptr(pointer p, remove_reference_t<D>&& d) noexcept;

Then we could simply say:

The second constructor is defined as deleted if is_reference_v<D> is true"

@timsong-cpp
Copy link
Contributor Author

Yes, that would fix it. In any event, p11 (the const A& case) seems redundant; it's just p10 (A&) with A being a const-qualified type.

@jwakely
Copy link
Member

jwakely commented Mar 10, 2017

Yes, it's a curious piece of wording :-)

It dates from the very early days of rvalue references and move semantics, so seems to be acting as a tutorial for how the constructors work.

@jensmaurer
Copy link
Member

@zygoloid, how much of this are you comfortable with addressing editorially?

@jensmaurer jensmaurer added the decision-required A decision of the editorial group (or the Project Editor) is required. label Mar 27, 2018
@jensmaurer
Copy link
Member

Editorial meeting consensus: Use of the word "signature" is definitely wrong. Delete p11 editorially. Replace "signature" with something else editorially. Replacing the "see below" with the real declarations is fine. Use English "if D is a reference type, the second constructor is defined as deleted."

@jensmaurer jensmaurer removed the decision-required A decision of the editorial group (or the Project Editor) is required. label Jun 7, 2018
@jensmaurer jensmaurer self-assigned this Sep 6, 2018
kraj pushed a commit to kraj/gcc that referenced this issue Sep 11, 2018
LWG DR 2905 says that is_constructible_v<unique_ptr<P, D>, P, D const &>
should be false when D is not copy constructible. This commit implements
the changes from the DR and simplifies the signatures as per
cplusplus/draft#1530

	* include/bits/unique_ptr.h (__uniq_ptr_impl): Add assertions to
	check deleter type.
	(unique_ptr::unique_ptr(pointer, const deleter_type&)): Add copy
	constructible constraint.
	(unique_ptr::unique_ptr(pointer, deleter_type&&)): Disable for
	deleters of reference type and add move constructible constraint.
	(unique_ptr::unique_ptr(pointer, remove_reference_t<deleter_type>&&)):
	Disable for deleters of non-reference type. Define as deleted.
	(unique_ptr<T[], D>): Likewise.
	* testsuite/20_util/unique_ptr/assign/48635_neg.cc: Replace dg-error
	directives with unstable line numbers with dg-prune-output.
	* testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc: Likewise.
	* testsuite/20_util/unique_ptr/cons/lwg2905.cc: New test.
	* testsuite/20_util/unique_ptr/specialized_algorithms/swap_cxx17.cc:
	Make deleter types invocable.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@264206 138bc75d-0d04-0410-961f-82ee72b054a4
asiekierka pushed a commit to WonderfulToolchain/gcc-ia16 that referenced this issue May 16, 2022
LWG DR 2905 says that is_constructible_v<unique_ptr<P, D>, P, D const &>
should be false when D is not copy constructible. This commit implements
the changes from the DR and simplifies the signatures as per
cplusplus/draft#1530

	* include/bits/unique_ptr.h (__uniq_ptr_impl): Add assertions to
	check deleter type.
	(unique_ptr::unique_ptr(pointer, const deleter_type&)): Add copy
	constructible constraint.
	(unique_ptr::unique_ptr(pointer, deleter_type&&)): Disable for
	deleters of reference type and add move constructible constraint.
	(unique_ptr::unique_ptr(pointer, remove_reference_t<deleter_type>&&)):
	Disable for deleters of non-reference type. Define as deleted.
	(unique_ptr<T[], D>): Likewise.
	* testsuite/20_util/unique_ptr/assign/48635_neg.cc: Replace dg-error
	directives with unstable line numbers with dg-prune-output.
	* testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc: Likewise.
	* testsuite/20_util/unique_ptr/cons/lwg2905.cc: New test.
	* testsuite/20_util/unique_ptr/specialized_algorithms/swap_cxx17.cc:
	Make deleter types invocable.

From-SVN: r264206
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

3 participants