Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,6 @@ constexpr bool test() {
}
};

struct NS : S1, S2 {}; // Non-standard layout

ASSERT(is_corresponding_member(&S1::v1, &S::v1));
ASSERT(is_corresponding_member(&S1::v2, &S::v2));
ASSERT(is_corresponding_member(&S1::v1, &S1::v1));
Expand All @@ -199,7 +197,6 @@ constexpr bool test() {
ASSERT(!is_corresponding_member(&S5::v1, &S6::v2));
ASSERT(!is_corresponding_member(&S5::v2, &S6::v1));
ASSERT(!is_corresponding_member(&S5::v3, &S6::v3));
ASSERT(!is_corresponding_member<NS, NS>(&NS::v1, &NS::w1));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assertion is directly translated from the example in the standard's [meta.member]. We might need to tell the committee that this example is problematic.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example does note that it fails, but not why it fails:

static_assert( is_corresponding_member<C, C>( &C::a, &C::b ) );
  // Forces the use of class C, and fails.

It's reasonable to assume that this would fail the static_assert, but it actually fails deduction.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it's better to use is_corresponding_member<C, C, int, int>( &C::a, &C::b ) to achieve implicit conversion. Correspondingly, it's perhaps better to modify the line in the test file to ASSERT(!is_corresponding_member<NS, NS, int, int>(&NS::v1, &NS::w1));.

ASSERT(!is_corresponding_member(&S7::f1, &S7::f1));
ASSERT(!is_corresponding_member(static_cast<int S1::*>(nullptr), static_cast<int S2::*>(nullptr)));
ASSERT(!is_corresponding_member(&S1::v1, static_cast<int S2::*>(nullptr)));
Expand Down Expand Up @@ -233,8 +230,6 @@ constexpr bool test() {
ASSERT(is_pointer_interconvertible_with_class(&U::v1));
ASSERT(is_pointer_interconvertible_with_class(&U::v2));

ASSERT(!is_pointer_interconvertible_with_class<NS>(&NS::a));
ASSERT(!is_pointer_interconvertible_with_class<NS>(&NS::b));
ASSERT(!is_pointer_interconvertible_with_class(&C::f1));
ASSERT(!is_pointer_interconvertible_with_class(static_cast<int A::*>(nullptr)));
}
Expand Down