From 5101c24f60997b3775624f5c9488ded8e9f3cdf2 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Fri, 5 Dec 2008 18:15:24 +0000 Subject: 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 --- clang/lib/AST/Expr.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'clang/lib/AST/Expr.cpp') 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(Decl)) + return NTTParm->getType()->isReferenceType(); + return isa(Decl) || isa(Decl) || // C++ 3.10p2: An lvalue refers to an object or function. (Ctx.getLangOptions().CPlusPlus && -- cgit v1.2.3