This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG1510595dce9c: [Sema] Mark explicit specialization declaration in a friend invalid (authored by ychen).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113245/new/ https://reviews.llvm.org/D113245 Files: clang/lib/Sema/SemaDecl.cpp clang/test/CXX/temp/temp.spec/temp.expl.spec/p20-2.cpp Index: clang/test/CXX/temp/temp.spec/temp.expl.spec/p20-2.cpp =================================================================== --- /dev/null +++ clang/test/CXX/temp/temp.spec/temp.expl.spec/p20-2.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +template<typename T> +void f(T); + +template<typename T> +struct A { + // expected-error@+1{{cannot declare an explicit specialization in a friend}} + template <> friend void f<>(int) {} +}; + +// Makes sure implicit instantiation here does not trigger +// the assertion "Member specialization must be an explicit specialization" +void foo(void) { + A<int> a; +} Index: clang/lib/Sema/SemaDecl.cpp =================================================================== --- clang/lib/Sema/SemaDecl.cpp +++ clang/lib/Sema/SemaDecl.cpp @@ -9202,6 +9202,7 @@ << Name << RemoveRange << FixItHint::CreateRemoval(RemoveRange) << FixItHint::CreateInsertion(InsertLoc, "<>"); + Invalid = true; } } } else {
Index: clang/test/CXX/temp/temp.spec/temp.expl.spec/p20-2.cpp =================================================================== --- /dev/null +++ clang/test/CXX/temp/temp.spec/temp.expl.spec/p20-2.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +template<typename T> +void f(T); + +template<typename T> +struct A { + // expected-error@+1{{cannot declare an explicit specialization in a friend}} + template <> friend void f<>(int) {} +}; + +// Makes sure implicit instantiation here does not trigger +// the assertion "Member specialization must be an explicit specialization" +void foo(void) { + A<int> a; +} Index: clang/lib/Sema/SemaDecl.cpp =================================================================== --- clang/lib/Sema/SemaDecl.cpp +++ clang/lib/Sema/SemaDecl.cpp @@ -9202,6 +9202,7 @@ << Name << RemoveRange << FixItHint::CreateRemoval(RemoveRange) << FixItHint::CreateInsertion(InsertLoc, "<>"); + Invalid = true; } } } else {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits