]> granicus.if.org Git - clang/commitdiff
Fix PR14321, a crash when Clang is built with GCC 4.7 at -O1 or greater.
authorMatt Beaumont-Gay <matthewbg@google.com>
Fri, 16 Nov 2012 01:14:52 +0000 (01:14 +0000)
committerMatt Beaumont-Gay <matthewbg@google.com>
Fri, 16 Nov 2012 01:14:52 +0000 (01:14 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168124 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/MicrosoftMangle.cpp

index 98da920a8faedb9c0c656a26e307dd5fe3035111..7a12c4da9516c4608a07ab94da75232271b5dd60 100644 (file)
@@ -373,7 +373,7 @@ isTemplate(const NamedDecl *ND,
       dyn_cast<ClassTemplateSpecializationDecl>(ND)) {
     TypeSourceInfo *TSI = Spec->getTypeAsWritten();
     if (TSI) {
-      TemplateSpecializationTypeLoc &TSTL =
+      TemplateSpecializationTypeLoc TSTL =
         cast<TemplateSpecializationTypeLoc>(TSI->getTypeLoc());
       TemplateArgumentListInfo LI(TSTL.getLAngleLoc(), TSTL.getRAngleLoc());
       for (unsigned i = 0, e = TSTL.getNumArgs(); i != e; ++i)