[clang] [clang-tools-extra] Revert "[Clang] support friend declarations with a dependent nested-name-specifier" (PR #208302)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 8 12:55:34 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-tools-extra
Author: Oleksandr Tarasiuk (a-tarasyuk)
<details>
<summary>Changes</summary>
Reverts llvm/llvm-project#<!-- -->191268
---
Revert dependent friend support due to a crash in access checking https://github.com/llvm/llvm-project/issues/208290
---
Patch is 142.99 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/208302.diff
41 Files Affected:
- (modified) clang-tools-extra/clang-doc/Serialize.cpp (+3)
- (modified) clang/docs/ReleaseNotes.md (-1)
- (modified) clang/include/clang/AST/ASTStructuralEquivalence.h (-2)
- (modified) clang/include/clang/AST/DeclFriend.h (+101-24)
- (modified) clang/include/clang/AST/DeclTemplate.h (+40-42)
- (modified) clang/include/clang/AST/RecursiveASTVisitor.h (+6-10)
- (modified) clang/include/clang/Basic/DeclNodes.td (+1-1)
- (modified) clang/include/clang/Basic/DiagnosticGroups.td (+1)
- (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (+10-7)
- (modified) clang/include/clang/Sema/Sema.h (-12)
- (modified) clang/include/clang/Sema/Template.h (+1-10)
- (modified) clang/include/clang/Sema/TemplateDeduction.h (+3-14)
- (modified) clang/include/clang/Serialization/ASTBitCodes.h (-7)
- (modified) clang/lib/AST/ASTImporter.cpp (+18-92)
- (modified) clang/lib/AST/ASTStructuralEquivalence.cpp (+1-58)
- (modified) clang/lib/AST/DeclFriend.cpp (+25-39)
- (modified) clang/lib/AST/DeclPrinter.cpp (+12-24)
- (modified) clang/lib/AST/DeclTemplate.cpp (+13-42)
- (modified) clang/lib/AST/ODRHash.cpp (-15)
- (modified) clang/lib/Sema/Sema.cpp (+2-3)
- (modified) clang/lib/Sema/SemaAccess.cpp (+98-651)
- (modified) clang/lib/Sema/SemaDeclCXX.cpp (+94-135)
- (modified) clang/lib/Sema/SemaOverload.cpp (+8-16)
- (modified) clang/lib/Sema/SemaTemplate.cpp (+7-3)
- (modified) clang/lib/Sema/SemaTemplateDeduction.cpp (-10)
- (modified) clang/lib/Sema/SemaTemplateInstantiateDecl.cpp (+61-140)
- (modified) clang/lib/Serialization/ASTReaderDecl.cpp (+13-17)
- (modified) clang/lib/Serialization/ASTWriterDecl.cpp (+15-20)
- (modified) clang/test/CXX/class.access/class.friend/p3-cxx0x.cpp (+2-2)
- (modified) clang/test/CXX/drs/cwg18xx.cpp (+8-8)
- (modified) clang/test/CXX/drs/cwg19xx.cpp (+6-5)
- (modified) clang/test/CXX/drs/cwg28xx.cpp (+1-2)
- (modified) clang/test/CXX/drs/cwg6xx.cpp (+8-11)
- (modified) clang/test/CXX/temp/temp.decls/temp.friend/p5.cpp (+10-257)
- (removed) clang/test/CXX/temp/temp.decls/temp.friend/p6.cpp (-27)
- (modified) clang/test/Parser/cxx2c-variadic-friends.cpp (+4-2)
- (modified) clang/test/SemaCXX/many-template-parameter-lists.cpp (+3-6)
- (modified) clang/test/SemaTemplate/GH71595.cpp (+2-6)
- (modified) clang/test/SemaTemplate/concepts-friends.cpp (-58)
- (modified) clang/test/SemaTemplate/ctad.cpp (+10-14)
- (modified) clang/test/SemaTemplate/friend-template.cpp (+5-29)
``````````diff
diff --git a/clang-tools-extra/clang-doc/Serialize.cpp b/clang-tools-extra/clang-doc/Serialize.cpp
index 5fa23416949c4..50118e0472075 100644
--- a/clang-tools-extra/clang-doc/Serialize.cpp
+++ b/clang-tools-extra/clang-doc/Serialize.cpp
@@ -1029,6 +1029,9 @@ void Serializer::parseFriends(RecordInfo &RI, const CXXRecordDecl *D) {
llvm::SmallVector<FriendInfo, 4> LocalFriends;
for (const FriendDecl *FD : D->friends()) {
+ if (FD->isUnsupportedFriend())
+ continue;
+
FriendInfo F(InfoType::IT_friend, getUSRForDecl(FD));
const auto *ActualDecl = FD->getFriendDecl();
if (!ActualDecl) {
diff --git a/clang/docs/ReleaseNotes.md b/clang/docs/ReleaseNotes.md
index b49a9db3d5fca..0626c41774960 100644
--- a/clang/docs/ReleaseNotes.md
+++ b/clang/docs/ReleaseNotes.md
@@ -246,7 +246,6 @@ latest release, please see the [Clang Web Site](https://clang.llvm.org) or the
- `__is_trivially_equality_comparable` no longer returns false for all enum types. (#GH132672)
- `auto` parameters are now available in all C++ language modes as an extension.
-- Clang now supports friend declarations with a dependent nested name specifier. (#GH104057)
#### C++2d Feature Support
diff --git a/clang/include/clang/AST/ASTStructuralEquivalence.h b/clang/include/clang/AST/ASTStructuralEquivalence.h
index 89d7f8d6ba8ff..6f82de1ae136d 100644
--- a/clang/include/clang/AST/ASTStructuralEquivalence.h
+++ b/clang/include/clang/AST/ASTStructuralEquivalence.h
@@ -135,8 +135,6 @@ struct StructuralEquivalenceContext {
/// \c VisitedDecls members) and can cause faulty equivalent results.
bool IsEquivalent(Stmt *S1, Stmt *S2);
- bool IsEquivalent(TemplateParameterList *TPL1, TemplateParameterList *TPL2);
-
/// Find the index of the given anonymous struct/union within its
/// context.
///
diff --git a/clang/include/clang/AST/DeclFriend.h b/clang/include/clang/AST/DeclFriend.h
index c68028d22bd54..1f8c210263677 100644
--- a/clang/include/clang/AST/DeclFriend.h
+++ b/clang/include/clang/AST/DeclFriend.h
@@ -15,13 +15,20 @@
#define LLVM_CLANG_AST_DECLFRIEND_H
#include "clang/AST/Decl.h"
+#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclCXX.h"
+#include "clang/AST/DeclTemplate.h"
+#include "clang/AST/ExternalASTSource.h"
#include "clang/AST/TypeLoc.h"
#include "clang/Basic/LLVM.h"
+#include "clang/Basic/SourceLocation.h"
+#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/PointerUnion.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
+#include "llvm/Support/TrailingObjects.h"
#include <cassert>
+#include <iterator>
namespace clang {
@@ -42,7 +49,9 @@ class ASTContext;
/// @endcode
///
/// The semantic context of a friend decl is its declaring class.
-class FriendDecl : public Decl {
+class FriendDecl final
+ : public Decl,
+ private llvm::TrailingObjects<FriendDecl, TemplateParameterList *> {
LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION();
public:
@@ -52,28 +61,46 @@ class FriendDecl : public Decl {
friend class CXXRecordDecl;
friend class CXXRecordDecl::friend_iterator;
- // Location of the '...', if present.
- SourceLocation EllipsisLoc;
-
- SourceLocation FriendLoc;
-
-protected:
// The declaration that's a friend of this class.
FriendUnion Friend;
+ // A pointer to the next friend in the sequence.
LazyDeclPtr NextFriend;
- FriendDecl(Kind K, DeclContext *DC, SourceLocation L, FriendUnion Friend,
- SourceLocation FriendL, SourceLocation EllipsisLoc = {})
- : Decl(K, DC, L), EllipsisLoc(EllipsisLoc), FriendLoc(FriendL),
- Friend(Friend), NextFriend() {}
+ // Location of the 'friend' specifier.
+ SourceLocation FriendLoc;
+
+ // Location of the '...', if present.
+ SourceLocation EllipsisLoc;
+
+ /// True if this 'friend' declaration is unsupported. Eventually we
+ /// will support every possible friend declaration, but for now we
+ /// silently ignore some and set this flag to authorize all access.
+ LLVM_PREFERRED_TYPE(bool)
+ unsigned UnsupportedFriend : 1;
+
+ // The number of "outer" template parameter lists in non-templatic
+ // (currently unsupported) friend type declarations, such as
+ // template <class T> friend class A<T>::B;
+ unsigned NumTPLists : 31;
+
+ FriendDecl(DeclContext *DC, SourceLocation L, FriendUnion Friend,
+ SourceLocation FriendL, SourceLocation EllipsisLoc,
+ ArrayRef<TemplateParameterList *> FriendTypeTPLists)
+ : Decl(Decl::Friend, DC, L), Friend(Friend), FriendLoc(FriendL),
+ EllipsisLoc(EllipsisLoc), UnsupportedFriend(false),
+ NumTPLists(FriendTypeTPLists.size()) {
+ llvm::copy(FriendTypeTPLists, getTrailingObjects());
+ }
- FriendDecl(Kind K, EmptyShell Empty) : Decl(K, Empty) {}
+ FriendDecl(EmptyShell Empty, unsigned NumFriendTypeTPLists)
+ : Decl(Decl::Friend, Empty), UnsupportedFriend(false),
+ NumTPLists(NumFriendTypeTPLists) {}
FriendDecl *getNextFriend() {
- if (NextFriend.isOffset())
- return getNextFriendSlowCase();
- return cast_or_null<FriendDecl>(NextFriend.get(nullptr));
+ if (!NextFriend.isOffset())
+ return cast_or_null<FriendDecl>(NextFriend.get(nullptr));
+ return getNextFriendSlowCase();
}
FriendDecl *getNextFriendSlowCase();
@@ -82,11 +109,14 @@ class FriendDecl : public Decl {
friend class ASTDeclReader;
friend class ASTDeclWriter;
friend class ASTNodeImporter;
+ friend TrailingObjects;
- static FriendDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L,
- FriendUnion Friend_, SourceLocation FriendL,
- SourceLocation EllipsisLoc = {});
- static FriendDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
+ static FriendDecl *
+ Create(ASTContext &C, DeclContext *DC, SourceLocation L, FriendUnion Friend_,
+ SourceLocation FriendL, SourceLocation EllipsisLoc = {},
+ ArrayRef<TemplateParameterList *> FriendTypeTPLists = {});
+ static FriendDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID,
+ unsigned FriendTypeNumTPLists);
/// If this friend declaration names an (untemplated but possibly
/// dependent) type, return the type; otherwise return null. This
@@ -96,27 +126,74 @@ class FriendDecl : public Decl {
return Friend.dyn_cast<TypeSourceInfo*>();
}
+ unsigned getFriendTypeNumTemplateParameterLists() const {
+ return NumTPLists;
+ }
+
+ TemplateParameterList *getFriendTypeTemplateParameterList(unsigned N) const {
+ return getTrailingObjects(NumTPLists)[N];
+ }
+
/// If this friend declaration doesn't name a type, return the inner
/// declaration.
NamedDecl *getFriendDecl() const {
return Friend.dyn_cast<NamedDecl *>();
}
+ /// Retrieves the location of the 'friend' keyword.
+ SourceLocation getFriendLoc() const {
+ return FriendLoc;
+ }
+
/// Retrieves the location of the '...', if present.
SourceLocation getEllipsisLoc() const { return EllipsisLoc; }
- SourceLocation getFriendLoc() const { return FriendLoc; }
+ /// Retrieves the source range for the friend declaration.
+ SourceRange getSourceRange() const override LLVM_READONLY {
+ if (TypeSourceInfo *TInfo = getFriendType()) {
+ SourceLocation StartL = (NumTPLists == 0)
+ ? getFriendLoc()
+ : getTrailingObjects()[0]->getTemplateLoc();
+ SourceLocation EndL = isPackExpansion() ? getEllipsisLoc()
+ : TInfo->getTypeLoc().getEndLoc();
+ return SourceRange(StartL, EndL);
+ }
+
+ if (isPackExpansion())
+ return SourceRange(getFriendLoc(), getEllipsisLoc());
+
+ if (NamedDecl *ND = getFriendDecl()) {
+ if (const auto *FD = dyn_cast<FunctionDecl>(ND))
+ return FD->getSourceRange();
+ if (const auto *FTD = dyn_cast<FunctionTemplateDecl>(ND))
+ return FTD->getSourceRange();
+ if (const auto *CTD = dyn_cast<ClassTemplateDecl>(ND))
+ return CTD->getSourceRange();
+ if (const auto *DD = dyn_cast<DeclaratorDecl>(ND)) {
+ if (DD->getOuterLocStart() != DD->getInnerLocStart())
+ return DD->getSourceRange();
+ }
+ return SourceRange(getFriendLoc(), ND->getEndLoc());
+ }
+
+ return SourceRange(getFriendLoc(), getLocation());
+ }
- SourceRange getSourceRange() const override LLVM_READONLY;
+ /// Determines if this friend kind is unsupported.
+ bool isUnsupportedFriend() const {
+ return UnsupportedFriend;
+ }
+ void setUnsupportedFriend(bool Unsupported) {
+ UnsupportedFriend = Unsupported;
+ }
bool isPackExpansion() const { return EllipsisLoc.isValid(); }
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
- static bool classofKind(Kind K) {
- return K >= firstFriend && K <= lastFriend;
- }
+ static bool classofKind(Kind K) { return K == Decl::Friend; }
};
+
/// An iterator over the friend declarations of a class.
class CXXRecordDecl::friend_iterator {
friend class CXXRecordDecl;
diff --git a/clang/include/clang/AST/DeclTemplate.h b/clang/include/clang/AST/DeclTemplate.h
index 95d5ab1b11bf2..4f5a4e1b7b8a6 100644
--- a/clang/include/clang/AST/DeclTemplate.h
+++ b/clang/include/clang/AST/DeclTemplate.h
@@ -19,7 +19,6 @@
#include "clang/AST/Decl.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclCXX.h"
-#include "clang/AST/DeclFriend.h"
#include "clang/AST/DeclarationName.h"
#include "clang/AST/Redeclarable.h"
#include "clang/AST/TemplateBase.h"
@@ -2462,51 +2461,45 @@ class ClassTemplateDecl : public RedeclarableTemplateDecl {
/// template \<typename U> friend class Foo<T>::Nested; // friend template
/// };
/// \endcode
-class FriendTemplateDecl final
- : public FriendDecl,
- private llvm::TrailingObjects<FriendTemplateDecl,
- TemplateParameterList *> {
- void anchor() override;
+///
+/// \note This class is not currently in use. All of the above
+/// will yield a FriendDecl, not a FriendTemplateDecl.
+class FriendTemplateDecl : public Decl {
+ virtual void anchor();
+
+public:
+ using FriendUnion = llvm::PointerUnion<NamedDecl *,TypeSourceInfo *>;
private:
- unsigned NumTPLists = 0;
- TemplateName Template;
+ // The number of template parameters; always non-zero.
+ unsigned NumParams = 0;
- FriendTemplateDecl(DeclContext *DC, SourceLocation Loc, FriendUnion Friend,
- SourceLocation FriendLoc, SourceLocation EllipsisLoc,
- ArrayRef<TemplateParameterList *> FriendTypeTPLists,
- TemplateName Template = {})
- : FriendDecl(Decl::FriendTemplate, DC, Loc, Friend, FriendLoc,
- EllipsisLoc),
- NumTPLists(FriendTypeTPLists.size()), Template(Template) {
- llvm::copy(FriendTypeTPLists, getTrailingObjects());
- }
+ // The parameter list.
+ TemplateParameterList **Params = nullptr;
+
+ // The declaration that's a friend of this class.
+ FriendUnion Friend;
+
+ // Location of the 'friend' specifier.
+ SourceLocation FriendLoc;
- FriendTemplateDecl(EmptyShell Empty, unsigned NumFriendTypeTPLists)
- : FriendDecl(Decl::FriendTemplate, Empty),
- NumTPLists(NumFriendTypeTPLists) {}
+ FriendTemplateDecl(DeclContext *DC, SourceLocation Loc,
+ TemplateParameterList **Params, unsigned NumParams,
+ FriendUnion Friend, SourceLocation FriendLoc)
+ : Decl(Decl::FriendTemplate, DC, Loc), NumParams(NumParams),
+ Params(Params), Friend(Friend), FriendLoc(FriendLoc) {}
+
+ FriendTemplateDecl(EmptyShell Empty) : Decl(Decl::FriendTemplate, Empty) {}
public:
friend class ASTDeclReader;
- friend class ASTDeclWriter;
- friend TrailingObjects;
static FriendTemplateDecl *
Create(ASTContext &Context, DeclContext *DC, SourceLocation Loc,
- FriendUnion Friend, SourceLocation FriendLoc,
- ArrayRef<TemplateParameterList *> FriendTypeTPLists = {},
- SourceLocation EllipsisLoc = {});
-
- static FriendTemplateDecl *
- Create(ASTContext &Context, DeclContext *DC, SourceLocation Loc,
- TemplateName Template, SourceLocation FriendLoc,
- ArrayRef<TemplateParameterList *> FriendTypeTPLists = {},
- SourceLocation EllipsisLoc = {});
-
- static FriendTemplateDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID,
- unsigned FriendTypeNumTPLists);
+ MutableArrayRef<TemplateParameterList *> Params, FriendUnion Friend,
+ SourceLocation FriendLoc);
- SourceRange getSourceRange() const override LLVM_READONLY;
+ static FriendTemplateDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);
/// If this friend declaration names a templated type (or
/// a dependent member type of a templated type), return that
@@ -2519,16 +2512,21 @@ class FriendTemplateDecl final
/// a member function of a templated type), return that type;
/// otherwise return null.
NamedDecl *getFriendDecl() const {
- if (TemplateDecl *TD = Template.getAsTemplateDecl())
- return TD;
- return Friend.dyn_cast<NamedDecl *>();
+ return Friend.dyn_cast<NamedDecl*>();
}
- TemplateName getFriendTemplateName() const { return Template; }
+ /// Retrieves the location of the 'friend' keyword.
+ SourceLocation getFriendLoc() const {
+ return FriendLoc;
+ }
- ArrayRef<TemplateParameterList *>
- getFriendTypeTemplateParameterLists() const {
- return ArrayRef(getTrailingObjects(), NumTPLists);
+ TemplateParameterList *getTemplateParameterList(unsigned i) const {
+ assert(i <= NumParams);
+ return Params[i];
+ }
+
+ unsigned getNumTemplateParameters() const {
+ return NumParams;
}
// Implement isa/cast/dyncast/etc.
diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h
index 4552437d3db9a..b77443f1fa0ab 100644
--- a/clang/include/clang/AST/RecursiveASTVisitor.h
+++ b/clang/include/clang/AST/RecursiveASTVisitor.h
@@ -1733,16 +1733,12 @@ DEF_TRAVERSE_DECL(FriendDecl, {
})
DEF_TRAVERSE_DECL(FriendTemplateDecl, {
- TemplateName Template = D->getFriendTemplateName();
- if (Template.isNull()) {
- if (D->getFriendType())
- TRY_TO(TraverseTypeLoc(D->getFriendType()->getTypeLoc()));
- else
- TRY_TO(TraverseDecl(D->getFriendDecl()));
- } else {
- TRY_TO(TraverseTemplateName(Template));
- }
- for (TemplateParameterList *TPL : D->getFriendTypeTemplateParameterLists()) {
+ if (D->getFriendType())
+ TRY_TO(TraverseTypeLoc(D->getFriendType()->getTypeLoc()));
+ else
+ TRY_TO(TraverseDecl(D->getFriendDecl()));
+ for (unsigned I = 0, E = D->getNumTemplateParameters(); I < E; ++I) {
+ TemplateParameterList *TPL = D->getTemplateParameterList(I);
for (TemplateParameterList::iterator ITPL = TPL->begin(), ETPL = TPL->end();
ITPL != ETPL; ++ITPL) {
TRY_TO(TraverseDecl(*ITPL));
diff --git a/clang/include/clang/Basic/DeclNodes.td b/clang/include/clang/Basic/DeclNodes.td
index c55a3d68184f4..ffb58b43812dc 100644
--- a/clang/include/clang/Basic/DeclNodes.td
+++ b/clang/include/clang/Basic/DeclNodes.td
@@ -99,7 +99,7 @@ def FileScopeAsm : DeclNode<Decl>;
def TopLevelStmt : DeclNode<Decl>, DeclContext;
def AccessSpec : DeclNode<Decl>;
def Friend : DeclNode<Decl>;
-def FriendTemplate : DeclNode<Friend>;
+def FriendTemplate : DeclNode<Decl>;
def StaticAssert : DeclNode<Decl>;
def ExplicitInstantiation : DeclNode<Decl>;
def Block : DeclNode<Decl, "blocks">, DeclContext;
diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td
index d353a86f228ba..79583534b9bbd 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -1198,6 +1198,7 @@ def Attributes : DiagGroup<"attributes", [UnknownAttributes,
def UnknownSanitizers : DiagGroup<"unknown-sanitizers">;
def UnnamedTypeTemplateArgs : DiagGroup<"unnamed-type-template-args",
[CXX98CompatUnnamedTypeTemplateArgs]>;
+def UnsupportedFriend : DiagGroup<"unsupported-friend">;
def UnusedArgument : DiagGroup<"unused-argument">;
def UnusedCommandLineArgument : DiagGroup<"unused-command-line-argument">;
def IgnoredOptimizationArgument : DiagGroup<"ignored-optimization-argument">;
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 3fa5bce9fb04f..38d9e4046d3a5 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -1916,6 +1916,16 @@ def err_friend_not_first_in_declaration : Error<
"'friend' must appear first in a non-function declaration">;
def err_using_decl_friend : Error<
"cannot befriend target of using declaration">;
+def warn_template_qualified_friend_unsupported
+ : Warning<
+ "dependent nested name specifier %0 for friend class declaration is "
+ "not supported; turning off access control for %1">,
+ InGroup<UnsupportedFriend>;
+def warn_template_qualified_friend_ignored
+ : Warning<"dependent nested name specifier %0 for friend template "
+ "declaration is "
+ "not supported; ignoring this friend declaration">,
+ InGroup<UnsupportedFriend>;
def ext_friend_tag_redecl_outside_namespace : ExtWarn<
"unqualified friend declaration referring to type outside of the nearest "
"enclosing namespace is a Microsoft extension; add a nested name specifier">,
@@ -1925,8 +1935,6 @@ def err_friend_template_decl_multiple_specifiers: Error<
"a friend declaration that befriends a template must contain exactly one type-specifier">;
def friend_template_decl_malformed_pack_expansion : Error<
"friend declaration expands pack %0 that is declared it its own template parameter list">;
-def err_dependent_friend_not_member : Error<
- "friend declaration does not name a member of a class template specialization">;
def err_invalid_base_in_interface : Error<
"interface type cannot inherit from "
@@ -5282,16 +5290,11 @@ def note_ovl_candidate_deduced_mismatch : Note<
"adjusted type of %select{|element of }4argument}1,2%3">;
def note_ovl_candidate_non_deduced_mismatch : Note<
"candidate template ignored: could not match %diff{$ against $|types}0,1">;
-def note_friend_template_non_deduced_mismatch : Note<
- "candidate friend template ignored: could not match "
- "%diff{$ against $|types}0,1">;
// This note is needed because the above note would sometimes print two
// different types with the same name. Remove this note when the above note
// can handle that case properly.
def note_ovl_candidate_non_deduced_mismatch_qualified : Note<
"candidate template ignored: could not match %q0 against %q1">;
-def note_friend_template_non_deduced_mismatch_qualified : Note<
- "candidate friend template ignored: could not match %q0 against %q1">;
// Note that we don't treat templates differently for this diagnostic.
def note_ovl_candidate_arity : Note<"candidate "
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index e658f57968b99..f7d0d493e7081 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -12018,9 +12018,6 @@ class Sema final : public SemaBase {
bool CheckMemberSpecialization(NamedDecl *Member, LookupResult &Previous);
void CompleteMemberSpecialization(NamedDecl *Member, LookupResult &Previous);
- bool CheckDependentFriend(SourceLocation Loc, NestedNameSpecifier NNS,
- TemplateParameterList *FPL);
-
// Explicit instantiation of a class template specialization
DeclResult ActOnExplicitInstantiation(
Scope *S, SourceLocation ExternLoc, SourceLocation TemplateLoc,
@@ -12754,15 +12751,6 @@ class Sema final : public SemaBase {
return false;
});
- /// Finish template argument deduction for a template declaration, checking
- /// the deduced template arguments for completeness and forming the deduced
- /// template argument list.
- TemplateDeductionResult FinishTemplateArgumentDeduction(
- TemplateDecl *TD, TemplateParameterList *TPL,
- ArrayRef<TemplateArgument> PatternArgs, ArrayRef<TemplateArgument> Args,
- ...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/208302
More information about the cfe-commits
mailing list