From 874094833caedbee43fd17cca164dec53d500bdc Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 4 Aug 2018 13:15:49 +0000 Subject: Vendor import of clang release_70 branch r338892: https://llvm.org/svn/llvm-project/cfe/branches/release_70@338892 --- lib/Sema/SemaInit.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/Sema/SemaInit.cpp') diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index f006a677b678..01ef86c656bb 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -6371,8 +6371,12 @@ static bool implicitObjectParamIsLifetimeBound(const FunctionDecl *FD) { const TypeSourceInfo *TSI = FD->getTypeSourceInfo(); if (!TSI) return false; + // Don't declare this variable in the second operand of the for-statement; + // GCC miscompiles that by ending its lifetime before evaluating the + // third operand. See gcc.gnu.org/PR86769. + AttributedTypeLoc ATL; for (TypeLoc TL = TSI->getTypeLoc(); - auto ATL = TL.getAsAdjusted(); + (ATL = TL.getAsAdjusted()); TL = ATL.getModifiedLoc()) { if (ATL.getAttrKind() == AttributedType::attr_lifetimebound) return true; -- cgit v1.3