summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorLarisse Voufo <lvoufo@google.com>2014-07-30 00:49:55 +0000
committerLarisse Voufo <lvoufo@google.com>2014-07-30 00:49:55 +0000
commitf73da98f488c8177eb69b846a9f6045e01db6792 (patch)
treeb045cc26dbace4682af2c4e96c97c43ab13c6e1a /clang/lib/Sema/SemaExpr.cpp
parentb7c305f0914f3785efa643f1b68686fb098f3f6e (diff)
downloadbcm5719-llvm-f73da98f488c8177eb69b846a9f6045e01db6792.tar.gz
bcm5719-llvm-f73da98f488c8177eb69b846a9f6045e01db6792.zip
Not all instantiated variable is odr-used. Do not mark non-odr-used variable template specializations as such.
llvm-svn: 214267
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index ea5ad77fc01..4675c45f2f8 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -12440,6 +12440,7 @@ static void DoMarkVarDeclReferenced(Sema &SemaRef, SourceLocation Loc,
Var->setReferenced();
TemplateSpecializationKind TSK = Var->getTemplateSpecializationKind();
+ bool MarkODRUsed = true;
// If the context is not potentially evaluated, this is not an odr-use and
// does not trigger instantiation.
@@ -12475,6 +12476,9 @@ static void DoMarkVarDeclReferenced(Sema &SemaRef, SourceLocation Loc,
if (!isTemplateInstantiation(TSK))
return;
+
+ // Instantiate, but do not mark as odr-used, variable templates.
+ MarkODRUsed = false;
}
VarTemplateSpecializationDecl *VarSpec =
@@ -12525,6 +12529,8 @@ static void DoMarkVarDeclReferenced(Sema &SemaRef, SourceLocation Loc,
}
}
+ if(!MarkODRUsed) return;
+
// Per C++11 [basic.def.odr], a variable is odr-used "unless it satisfies
// the requirements for appearing in a constant expression (5.19) and, if
// it is an object, the lvalue-to-rvalue conversion (4.1)
OpenPOWER on IntegriCloud