Skip to content

Sema::checkPointerTypesForAssignment calls IsFunctionConversion with From/To reversed #85415

@dougsonos

Description

@dougsonos

At the end of Sema::checkPointerTypesForAssignment:

  if (!S.getLangOpts().CPlusPlus &&
      S.IsFunctionConversion(ltrans, rtrans, ltrans))

ltrans and rtrans are the left and right sides of the assignment, and are therefore the destination and source types, respectively.

But:

bool Sema::IsFunctionConversion(QualType FromType, QualType ToType,
                                QualType &ResultTy) {

Here the source is first and the destination is second.

Maybe this a bug that has gone unnoticed because IsFunctionConversion tends to work symmetrically? (speculating)

Or maybe there is a good reason for checkPointerTypesForAssignment to invert the parameters, but it's not commented or at all apparent by source inspection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions