Index: clang/lib/AST/Interp/ByteCodeExprGen.cpp =================================================================== --- clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -676,6 +676,8 @@ template bool ByteCodeExprGen::VisitStringLiteral(const StringLiteral *E) { + if (DiscardResult) + return true; unsigned StringIndex = P.createGlobalString(E); return this->emitGetPtrGlobal(StringIndex, E); } @@ -683,6 +685,8 @@ template bool ByteCodeExprGen::VisitCharacterLiteral( const CharacterLiteral *E) { + if (DiscardResult) + return true; return this->emitConst(E->getValue(), E); } Index: clang/test/AST/Interp/literals.cpp =================================================================== --- clang/test/AST/Interp/literals.cpp +++ clang/test/AST/Interp/literals.cpp @@ -901,6 +901,8 @@ (int[]){1,2,3}; int arr[] = {1,2,3}; arr[0]; + "a"; + 'b'; return 0; }