aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorVlad Serebrennikov <serebrennikov.vladislav@gmail.com>2024-07-18 19:29:51 +0400
committerGitHub <noreply@github.com>2024-07-18 19:29:51 +0400
commit2bdcfbe62cb9a08df4b58a17d44be0a3082df053 (patch)
tree817baa81151e5c2c48fb3cdd2eb69d73b136cc16 /clang/lib/Sema/SemaDecl.cpp
parent497ea1d84951626dea5bf644fef2d99e145e21ac (diff)
downloadllvm-2bdcfbe62cb9a08df4b58a17d44be0a3082df053.zip
llvm-2bdcfbe62cb9a08df4b58a17d44be0a3082df053.tar.gz
llvm-2bdcfbe62cb9a08df4b58a17d44be0a3082df053.tar.bz2
[clang] Fix crash in concept deprecation (#98622)
There is a gap between `getAs<AutoType>()` and `getConstrainedAutoType()` that the original patch #92295 was not aware of. Fixes #98164
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 6c3589b..bb25a0b 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -7436,10 +7436,10 @@ NamedDecl *Sema::ActOnVariableDeclarator(
tryToFixVariablyModifiedVarType(TInfo, R, D.getIdentifierLoc(),
/*DiagID=*/0);
- if (const AutoType *AutoT = R->getAs<AutoType>())
- CheckConstrainedAuto(
- AutoT,
- TInfo->getTypeLoc().getContainedAutoTypeLoc().getConceptNameLoc());
+ if (AutoTypeLoc TL = TInfo->getTypeLoc().getContainedAutoTypeLoc()) {
+ const AutoType *AT = TL.getTypePtr();
+ CheckConstrainedAuto(AT, TL.getConceptNameLoc());
+ }
bool IsMemberSpecialization = false;
bool IsVariableTemplateSpecialization = false;