Index: clang/lib/AST/Interp/Interp.h =================================================================== --- clang/lib/AST/Interp/Interp.h +++ clang/lib/AST/Interp/Interp.h @@ -437,7 +437,7 @@ T Result; if constexpr (DoPush == PushVal::Yes) - S.Stk.push(Result); + S.Stk.push(Value); if constexpr (Op == IncDecOp::Inc) { if (!T::increment(Value, &Result)) { Index: clang/test/AST/Interp/literals.cpp =================================================================== --- clang/test/AST/Interp/literals.cpp +++ clang/test/AST/Interp/literals.cpp @@ -706,6 +706,23 @@ // ref-note {{cannot refer to element -1 of array of 3 elements}} return *p; } + + /// This used to leave a 0 on the stack instead of the previous + /// value of a. + constexpr int bug1Inc() { + int a = 3; + int b = a++; + return b; + } + static_assert(bug1Inc() == 3); + + constexpr int bug1Dec() { + int a = 3; + int b = a--; + return b; + } + static_assert(bug1Dec() == 3); + }; #endif