[PATCH] D78623: [flang] Semantic checks for SELECT RANK

Peter Klausler via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 7 13:35:43 PDT 2020


klausler added inline comments.


================
Comment at: flang/lib/Semantics/resolve-names.cpp:5111
+    MakePlaceholder(*name, MiscDetails::Kind::SelectRankAssociateName);
+    association.name = &*name;
+  }
----------------
DavidTruby wrote:
> klausler wrote:
> > DavidTruby wrote:
> > > Why does this need de-referencing and then referencing again?
> > Because it's not a pointer.
> No.. and neither is the thing it is being assigned to? I don't understand how it not being a pointer is relevant.

`name` is a reference to a `std::optional<parser::Name>`.

`*name` is a reference to a `parser::Name`.

`&*name` is an rvalue pointer to a `parser::Name`.

`association.name` is an lvalue whose type is pointer to a `const parser::Name`.

`association.name = &*name;` assigns a pointer rvalue to a pointer lvalue.


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

https://reviews.llvm.org/D78623





More information about the llvm-commits mailing list