aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-03-02 04:14:40 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-03-02 04:14:40 +0000
commit16581335fc32abcbc6ab14eda7af38cf759664b7 (patch)
treeee8e69c07d34c7c01643e5cdbd2be42e7aed780c /lib/Sema/SemaExpr.cpp
parent0524171a57e6f9f6ee79c02ed4e20c5914d8b2db (diff)
Ensure that we instantiate static reference data members of class templates
early, since their values can be used in constant expressions in C++11. For odr-use checking, the opposite change is required, since references are odr-used whether or not they satisfy the requirements for appearing in a constant expression. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151881 91177308-0d34-0410-b5e6-96231b3b80d8
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);