This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Fix missing requires clause on variant operator<=>
ClosedPublic

Authored by jloser on Oct 16 2022, 7:26 PM.

Details

Summary

std::variant::operator<=> is missing a requires clause ensuring that
operator<=> only exists when all of the types in the variant are
three_way_comparable.

Add the missing requires clause and adjust the existing test which was
incorrect.

Fixes https://github.com/llvm/llvm-project/issues/58192.

Diff Detail

Event Timeline

jloser created this revision.Oct 16 2022, 7:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 16 2022, 7:26 PM
jloser requested review of this revision.Oct 16 2022, 7:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 16 2022, 7:26 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
jloser updated this revision to Diff 468211.Oct 17 2022, 8:12 AM

Another test fix

Mordante accepted this revision.Oct 17 2022, 9:08 AM

LGTM modulo some minor nits.

libcxx/include/variant
168

Please add the requires here too.

libcxx/test/std/utilities/variant/variant.relops/three_way.pass.cpp
15

Please add the requires here too.

This revision is now accepted and ready to land.Oct 17 2022, 9:08 AM
jloser updated this revision to Diff 468259.Oct 17 2022, 10:55 AM

Add requires clause to synopsis in both <variant> and the three_way_pass.cpp.

jloser marked 2 inline comments as done.Oct 17 2022, 10:55 AM
jloser added inline comments.
libcxx/include/variant
168

Added here and in the test file. Thanks!

This revision was automatically updated to reflect the committed changes.
jloser marked an inline comment as done.

thanks! LGTM. i must have been looking at a reference that's missing that requires...

thanks! LGTM. i must have been looking at a reference that's missing that requires...

No worries, easy to fix.