-
Notifications
You must be signed in to change notification settings - Fork 245
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
refactor: improve UFCS error messages #490
Conversation
What do you think about having a single UFCS macro: https://compiler-explorer.com/z/hbaacdf16? Beforeauto main() -> int{
CPP2_UFCS(push_back, vi, "oops");
CPP2_UFCS_0(push_back, vi);
CPP2_UFCS_TEMPLATE(push_back, (<0>), vi, "oops");
CPP2_UFCS_TEMPLATE_0(push_back, (<0>), vi);
CPP2_UFCS_TEMPLATE(push_back, (<0,0>), vi, 0, 0);
}
cpp2::i32 i0 {CPP2_UFCS_NONLOCAL(push_back, vi, "oops")};
cpp2::i32 i1 {CPP2_UFCS_0_NONLOCAL(push_back, vi)};
cpp2::i32 i2 {CPP2_UFCS_TEMPLATE_NONLOCAL(push_back, (<0>), vi, "oops")};
cpp2::i32 i3 {CPP2_UFCS_TEMPLATE_0_NONLOCAL(push_back, (<0>), vi)};
cpp2::i32 i4 {CPP2_UFCS_TEMPLATE_NONLOCAL(push_back, (<0,0>), vi, 0, 0)}; After
auto main_() -> int {
CPP2_UFCS(&,,(push_back),vi,(,),"oops");
CPP2_UFCS(&,,(push_back),vi,());
CPP2_UFCS(&,template,(push_back<0>),vi,(,),"oops");
CPP2_UFCS(&,template,(push_back<0>),vi,());
CPP2_UFCS(&,template,(push_back<0, 0>),vi,(,), 0, 0);
}
cpp2::i32 i5 {CPP2_UFCS(,,(push_back),vi,(,),"oops")};
cpp2::i32 i6 {CPP2_UFCS(,,(push_back),vi,())};
cpp2::i32 i7 {CPP2_UFCS(,template,(push_back<0>),vi,(,),"oops")};
cpp2::i32 i8 {CPP2_UFCS(,template,(push_back<0>),vi,())};
cpp2::i32 i9 {CPP2_UFCS(,template,(push_back<0, 0>),vi,(,), 0, 0)}; Or somewhere in-between. |
I think this should be superseded by the resolution for #497. The error message on Clang is pretty good:Relevant lines:
Full output:
GCC with `-fconcepts-diagnostics-depth=2`:Relevant lines:
Full output:
MSVC:Full output:
|
Marking as draft to prevent merging |
|
Resolves #439.
See it working at https://compiler-explorer.com/z/7asaMGY9o.
Before and after
Clang before
Clang after
GCC before
GCC after
Testing summary.
Acknowledgements.