aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r--lib/Sema/SemaExpr.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 6deffa2abd..ece16e8850 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -10108,9 +10108,10 @@ static void DoMarkVarDeclReferenced(Sema &SemaRef, SourceLocation Loc,
// is immediately applied." We check the first part here, and
// Sema::UpdateMarkingForLValueToRValue deals with the second part.
// Note that we use the C++11 definition everywhere because nothing in
- // C++03 depends on whether we get the C++03 version correct.
+ // C++03 depends on whether we get the C++03 version correct. This does not
+ // apply to references, since they are not objects.
const VarDecl *DefVD;
- if (E && !isa<ParmVarDecl>(Var) &&
+ if (E && !isa<ParmVarDecl>(Var) && !Var->getType()->isReferenceType() &&
Var->isUsableInConstantExpressions() &&
Var->getAnyInitializer(DefVD) && DefVD->checkInitIsICE())
SemaRef.MaybeODRUseExprs.insert(E);