================ @@ -271,3 +271,33 @@ void operators() { if (to_int_int) {} // expected-error {{attempt to use a deleted function: deleted (TO<int, int>, operator bool)}} static_cast<bool>(to_int_int); // expected-error {{static_cast from 'TO<int, int>' to 'bool' uses deleted function: deleted (TO<int, int>, operator bool)}} }; + +namespace gh135506 { +struct a { + // FIXME: We currently don't diagnose these invalid redeclarations if the + // second declaration is defaulted or deleted. This probably needs to be + // handled in ParseCXXInlineMethodDef() after parsing the defaulted/deleted + // body. + friend consteval int f() { return 3; } + friend consteval int f() = delete("foo"); + + friend consteval int g() { return 3; } + friend consteval int g() = delete; + + friend int h() { return 3; } + friend int h() = delete; + + friend consteval int i() = delete; // expected-note {{previous definition is here}} + friend consteval int i() { return 3; } // expected-error {{redefinition of 'i'}} +}; + +struct b { + friend consteval bool operator==(b, b) { return true; } // expected-note {{previous declaration is here}} + friend consteval bool operator==(b, b) = default; // expected-error {{defaulting this equality comparison operator is not allowed because it was already declared outside the class}} ---------------- Fznamznon wrote:
This diagnostic is a bit off, the previous declaration is not outside the class. https://github.com/llvm/llvm-project/pull/135679 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits