diff options
author | Matheus Izvekov <mizvekov@gmail.com> | 2024-08-03 00:36:48 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-03 00:36:48 -0300 |
commit | 1299af66322aa21246b0de6204dff553e46c408c (patch) | |
tree | 10ad81e45b5f5476df3bc01f47c8fdd941b8b92f /clang/lib/AST/ExprClassification.cpp | |
parent | cad835266ea12dbb3b602d9ae9ae479a550c47b4 (diff) | |
download | llvm-1299af66322aa21246b0de6204dff553e46c408c.zip llvm-1299af66322aa21246b0de6204dff553e46c408c.tar.gz llvm-1299af66322aa21246b0de6204dff553e46c408c.tar.bz2 |
[clang] create class-type injected NTTP with correct value kind (#101395)
A template parameter object is an lvalue, which was not being respected
for injected parameters.
Fixes #101394
Diffstat (limited to 'clang/lib/AST/ExprClassification.cpp')
-rw-r--r-- | clang/lib/AST/ExprClassification.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/AST/ExprClassification.cpp b/clang/lib/AST/ExprClassification.cpp index 8c5613d..1f1b8ab 100644 --- a/clang/lib/AST/ExprClassification.cpp +++ b/clang/lib/AST/ExprClassification.cpp @@ -485,12 +485,13 @@ static Cl::Kinds ClassifyInternal(ASTContext &Ctx, const Expr *E) { /// ClassifyDecl - Return the classification of an expression referencing the /// given declaration. static Cl::Kinds ClassifyDecl(ASTContext &Ctx, const Decl *D) { - // C++ [expr.prim.general]p6: The result is an lvalue if the entity is a - // function, variable, or data member and a prvalue otherwise. + // C++ [expr.prim.id.unqual]p3: The result is an lvalue if the entity is a + // function, variable, or data member, or a template parameter object and a + // prvalue otherwise. // In C, functions are not lvalues. // In addition, NonTypeTemplateParmDecl derives from VarDecl but isn't an - // lvalue unless it's a reference type (C++ [temp.param]p6), so we need to - // special-case this. + // lvalue unless it's a reference type or a class type (C++ [temp.param]p8), + // so we need to special-case this. if (const auto *M = dyn_cast<CXXMethodDecl>(D)) { if (M->isImplicitObjectMemberFunction()) |