From c08fa185961a38a1d972ccc7267206d0382f81f3 Mon Sep 17 00:00:00 2001 From: Matt Beaumont-Gay Date: Fri, 16 Nov 2012 01:14:52 +0000 Subject: [PATCH] Fix PR14321, a crash when Clang is built with GCC 4.7 at -O1 or greater. GCC 4.7 reuses stack slots fairly aggressively, which exposes more temporary lifetime bugs. No new test, this was caught by the existing CodeGenCXX/mangle-ms-templates.cpp. llvm-svn: 168124 --- clang/lib/AST/MicrosoftMangle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index 98da920..7a12c4d 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -373,7 +373,7 @@ isTemplate(const NamedDecl *ND, dyn_cast(ND)) { TypeSourceInfo *TSI = Spec->getTypeAsWritten(); if (TSI) { - TemplateSpecializationTypeLoc &TSTL = + TemplateSpecializationTypeLoc TSTL = cast(TSI->getTypeLoc()); TemplateArgumentListInfo LI(TSTL.getLAngleLoc(), TSTL.getRAngleLoc()); for (unsigned i = 0, e = TSTL.getNumArgs(); i != e; ++i) -- 2.7.4