This is an archive of the discontinued LLVM Phabricator instance.

ICK_Function_Conversion is a third kind conversion
ClosedPublic

Authored by aaronpuchert on Sep 3 2019, 10:37 AM.

Details

Summary

Not sure if this has any effect, but it was inconsistent before.

Diff Detail

Event Timeline

aaronpuchert created this revision.Sep 3 2019, 10:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 3 2019, 10:37 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Remove wrong changes in SemaExprCXX.cpp.

aaronpuchert retitled this revision from ICK_Function_Conversion and ICK_Qualification are third kind conversions to ICK_Function_Conversion is a third kind conversion.Sep 3 2019, 3:27 PM

@rsmith Could you have a look at this?

Maybe this is to trivial for a review. The comment on StandardConversionSequence::Third in clang/Sema/Overload.h says

The third conversion can be a qualification conversion or a function conversion.

Maybe this is to trivial for a review. The comment on StandardConversionSequence::Third in clang/Sema/Overload.h says

The third conversion can be a qualification conversion or a function conversion.

There may be a deeper issue here in that there are four standard conversion sequences, not three: http://eel.is/c++draft/conv#1, but otherwise this change seems correct to me (function conversion is certainly not in the first group).

Do you have a test case which can exercise this change?

There may be a deeper issue here in that there are four standard conversion sequences, not three: http://eel.is/c++draft/conv#1, but otherwise this change seems correct to me (function conversion is certainly not in the first group).

It seems we've collapsed the third and fourth kind into one, I wonder if that makes a difference. This can even be observed in the AST:

void f() noexcept;
void (*const fp)() = f;
//     VarDecl fp 'void (*const)()' cinit
// (2) `-ImplicitCastExpr 'void (*const)()' <NoOp>
// (1)   `-ImplicitCastExpr 'void (*)() noexcept' <FunctionToPointerDecay>
//         `-DeclRefExpr 'void () noexcept' lvalue Function 'f' 'void () noexcept'

where (1) is a first kind conversion, and (2) a combined third and fourth kind conversion. Since both are essentially no-ops (see also D67112), it probably doesn't make sense to go into more detail.

Do you have a test case which can exercise this change?

Nope, just discovered this while reading the code. This should be unreachable, so it would be bad if I could observe a change.

rsmith accepted this revision.Aug 28 2020, 5:21 PM
This revision is now accepted and ready to land.Aug 28 2020, 5:21 PM