[PATCH] D74116: [Sema][C++] Strawman patch to propagate conversion type in order to specialize the diagnostics
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 12 08:51:54 PST 2020
rjmccall added a comment.
Ah, yes, we're laxer about these things in C than we are in C++. If we do this, we'll need to go through `DiagnoseAssignmentResult` and make sure that everything (except `Compatible`, which we'll never pass) triggers an error in C++ mode.
Is there a good reason to just do this for pointer types instead of unconditionally calling `CheckAssignmentConstraints`? It'd be nice to take advantage of any specialized diagnostics we have for C/ObjC/whatever in C++ mode, and that can apply to a lot of types that aren't pointer types.
It looks like there's already some type analysis in `DiagnoseAssignmentResult` to get a specialized diagnostic for certain cases of function-pointer assignment. That could probably be easily moved into `CheckAssignmentConstraints` by just adding a few more cases to `AssignConvertResult`.
And yeah, it's possible that we'll need to teach that function about some C++ cases that it currently never sees. But I don't think that needs to include references, because IIRC reference-binding doesn't go through `ImplicitConversionSequence`.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74116/new/
https://reviews.llvm.org/D74116
More information about the cfe-commits
mailing list