[PATCH] D119095: [clang] Fix redundant functional cast in ConstantExpr

Evgeny Shulgin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 6 14:10:52 PST 2022


Izaron added a comment.

There are some godbolt links in the github issues.

Expression `A{}.f();` generates the call of the move constructor from nowhere as well - https://godbolt.org/z/MceYedKzj

With the patch this node (that lives inside an another `ConstantExpr` node):

  MemberExpr 0x55555e48b3d8 '<bound member function type>' .f 0x55555e48aa98
  `-MaterializeTemporaryExpr 0x55555e48b3c0 'struct A' xvalue
    `-CXXFunctionalCastExpr 0x55555e48b398 'struct A' functional cast to struct A <NoOp>
      `-ConstantExpr 0x55555e48b200 'struct A'
        `-CXXTemporaryObjectExpr 0x55555e48b1d0 'struct A' 'void (void)' list

transforms to this:

  MemberExpr 0x55555e48b3d8 '<bound member function type>' .f 0x55555e48aa98
  `-MaterializeTemporaryExpr 0x55555e48b3c0 'struct A' xvalue
    `-CXXTemporaryObjectExpr 0x55555e48b1d0 'struct A' 'void (void)' list

I reviewed other github issues about consteval. This patch doesn't fix other known issues as I checked.

//P.S. If this review is eventually approved, kindly please merge the commit on my behalf =) As I don't have merge access. My name is `Evgeny Shulgin` and email is `izaronplatz at gmail.com`. Sorry for inconvenience!//


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119095



More information about the cfe-commits mailing list