[PATCH] D103962: [C++4OpenCL] Fix qualifiers check on binding references to temporaries

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 17 08:27:57 PDT 2021


Anastasia accepted this revision.
Anastasia added a comment.
This revision is now accepted and ready to land.

LGTM! Yes it seems the only situation where the check would evaluate to a different value with and without your patch is when we have `RefRelationship == Sema::Ref_Related` as false while the address space is not a superset then we would get an incorrect diagnostic. But I feel this would be diagnosed elsewhere before we end up in this check.

FYI I was trying the following test case:

  void square(int num) {
    private int i = 0;
    private const float &ref = ++i;
  }

but it also fails with your patch which makes me feel there is a bug elsewhere too:

`error: reference of type 'const __private float &__private' cannot bind to a temporary object because of address space mismatch`

However I do believe that the fix makes sense because that particular check was intended for when `RefRelationship == Sema::Ref_Related` evaluates to true.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103962/new/

https://reviews.llvm.org/D103962



More information about the cfe-commits mailing list