tbaeder marked an inline comment as done. tbaeder added inline comments.
================ Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:213-214 + if (BO->isPtrMemOp()) + return this->visit(RHS); + ---------------- aaron.ballman wrote: > tbaeder wrote: > > aaron.ballman wrote: > > > Do we need similar changes for unary operators, pointer arithmetic > > > operators, etc? > > In what case would we need similar changes for those? > I could use some more explanation for the changes here then; I thought this > was to support overloaded binary operators. e.g., > ``` > struct S { > virtual constexpr int operator+(S s) const { > return 12; > } > }; > > struct T : S { > constexpr int operator+(S s) const override { > return 100; > } > }; > > constexpr T t1, t2; > constexpr const S &s1 = t1, &s2 = t2; > constexpr const S s3, s4; > static_assert(s1 + s2 == 100); > static_assert(s3 + s4 == 12); > ``` For this snippet from the tests: ``` constexpr S s; constexpr decltype(&S::func) foo = &S::func; constexpr int value = (s.*foo)(); static_assert(value == 1); ``` `value` is: ``` VarDecl 0x6210000a5180 <array.cpp:131:3, col:34> col:17 value 'const int' constexpr cinit `-CXXMemberCallExpr 0x6210000a52d8 <col:25, col:34> 'int' `-ParenExpr 0x6210000a52b0 <col:25, col:32> '<bound member function type>' `-BinaryOperator 0x6210000a5288 <col:26, col:29> '<bound member function type>' '.*' |-DeclRefExpr 0x6210000a51f0 <col:26> 'const S':'const S' lvalue Var 0x6210000a0cf8 's' 'const S':'const S' `-ImplicitCastExpr 0x6210000a5268 <col:29> 'decltype(&S::func)':'int (S::*)() const' <LValueToRValue> `-DeclRefExpr 0x6210000a5240 <col:29> 'const decltype(&S::func)':'int (S::*const)() const' lvalue Var 0x6210000a0fc0 'foo' 'const decltype(&S::func)':'int (S::*const)() const' non_odr_use_constant ``` notice the `BinaryOperator`. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D144164/new/ https://reviews.llvm.org/D144164 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits