Don't capture DeclRefExpr::getNameInfo().getInfo(). It returns reference in temporary object.

DeclarationNameInfo::getInfo() returns reference, but DeclRefExpr::getNameInfo() returns temporary DeclarationNameInfo().

It triggered a local crash for me.

  Failing Tests (1):
      Clang :: SemaTemplate/instantiate-overload-candidates.cpp

  Assertion failed!
  Program: bin\clang.EXE
  File: clang/lib/Basic/SourceManager.cpp, Line 822
  Expression: 0 && "Invalid SLocOffset or bad function choice"

llvm-svn: 220841
This commit is contained in:
NAKAMURA Takumi 2014-10-29 08:11:47 +00:00
parent 815d752b93
commit 44d4d9a4cb
1 changed files with 1 additions and 1 deletions

View File

@ -10460,7 +10460,7 @@ TreeTransform<Derived>::RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op,
SourceLocation RBrace;
if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Callee)) {
DeclarationNameLoc &NameLoc = DRE->getNameInfo().getInfo();
DeclarationNameLoc NameLoc = DRE->getNameInfo().getInfo();
LBrace = SourceLocation::getFromRawEncoding(
NameLoc.CXXOperatorName.BeginOpNameLoc);
RBrace = SourceLocation::getFromRawEncoding(