summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Expr.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2008-12-05 18:15:24 +0000
committerDouglas Gregor <dgregor@apple.com>2008-12-05 18:15:24 +0000
commit5101c24f60997b3775624f5c9488ded8e9f3cdf2 (patch)
tree2807802cd135f700026aa90f8d842508b2630d5a /clang/lib/AST/Expr.cpp
parent43c08918389ca2f928a94a4f2a5faa256a10e8e4 (diff)
downloadbcm5719-llvm-5101c24f60997b3775624f5c9488ded8e9f3cdf2.tar.gz
bcm5719-llvm-5101c24f60997b3775624f5c9488ded8e9f3cdf2.zip
Representation of template type parameters and non-type template
parameters, with some semantic analysis: - Template parameters are introduced into template parameter scope - Complain about template parameter shadowing (except in Microsoft mode) Note that we leak template parameter declarations like crazy, a problem we'll remedy once we actually create proper declarations for templates. Next up: dependent types and value-dependent/type-dependent expressions. llvm-svn: 60597
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
-rw-r--r--clang/lib/AST/Expr.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index e4386eceda1..a3264b010b7 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -341,6 +341,12 @@ bool Expr::hasLocalSideEffect() const {
/// DeclCanBeLvalue - Determine whether the given declaration can be
/// an lvalue. This is a helper routine for isLvalue.
static bool DeclCanBeLvalue(const NamedDecl *Decl, ASTContext &Ctx) {
+ // C++ [temp.param]p6:
+ // A non-type non-reference template-parameter is not an lvalue.
+ if (const NonTypeTemplateParmDecl *NTTParm
+ = dyn_cast<NonTypeTemplateParmDecl>(Decl))
+ return NTTParm->getType()->isReferenceType();
+
return isa<VarDecl>(Decl) || isa<CXXFieldDecl>(Decl) ||
// C++ 3.10p2: An lvalue refers to an object or function.
(Ctx.getLangOptions().CPlusPlus &&
OpenPOWER on IntegriCloud