diff options
author | Richard Smith <richard@metafoo.co.uk> | 2023-04-26 16:53:34 -0700 |
---|---|---|
committer | Richard Smith <richard@metafoo.co.uk> | 2023-04-26 16:55:30 -0700 |
commit | 1e43349e321694d7fee3d77cb691887ad67fb5d7 (patch) | |
tree | 48ce4d61c37d1d46742d1b752be2e3e2236d75e0 /clang/lib/Sema/SemaInit.cpp | |
parent | 919382004f4e3bd08a25fd8a8dbd3b4b1e5dc9fa (diff) | |
download | llvm-1e43349e321694d7fee3d77cb691887ad67fb5d7.zip llvm-1e43349e321694d7fee3d77cb691887ad67fb5d7.tar.gz llvm-1e43349e321694d7fee3d77cb691887ad67fb5d7.tar.bz2 |
Pass the found declaration to DiagnoseUseOfDecl.
Don't pass in the resolved declaration, because that might be an
inheriting constructor declaration, which should never be used directly
and for which constraint satisfaction checking doesn't work.
Fixes #62361.
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r-- | clang/lib/Sema/SemaInit.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index 018ba5e..243c3c1 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -6885,7 +6885,7 @@ PerformConstructorInitialization(Sema &S, if (isExplicitTemporary(Entity, Kind, NumArgs)) { // An explicitly-constructed temporary, e.g., X(1, 2). - if (S.DiagnoseUseOfDecl(Constructor, Loc)) + if (S.DiagnoseUseOfDecl(Step.Function.FoundDecl, Loc)) return ExprError(); TypeSourceInfo *TSInfo = Entity.getTypeSourceInfo(); @@ -6900,8 +6900,6 @@ PerformConstructorInitialization(Sema &S, if (auto *Shadow = dyn_cast<ConstructorUsingShadowDecl>( Step.Function.FoundDecl.getDecl())) { CalleeDecl = S.findInheritingConstructor(Loc, Constructor, Shadow); - if (S.DiagnoseUseOfDecl(CalleeDecl, Loc)) - return ExprError(); } S.MarkFunctionReferenced(Loc, CalleeDecl); @@ -10608,7 +10606,7 @@ QualType Sema::DeduceTemplateSpecializationFromInitializer( // Make sure we didn't select an unusable deduction guide, and mark it // as referenced. - DiagnoseUseOfDecl(Best->Function, Kind.getLocation()); + DiagnoseUseOfDecl(Best->FoundDecl, Kind.getLocation()); MarkFunctionReferenced(Kind.getLocation(), Best->Function); break; } |