saar.raz added inline comments.
================ Comment at: lib/Sema/SemaDecl.cpp:8377-8381 + } else if (D.hasTrailingRequiresClause()) { + // C++2a [class.virtual]p6 + // A virtual method shall not have a requires-clause. + Diag(NewFD->getTrailingRequiresClause()->getLocStart(), + diag::err_constrained_virtual_method); ---------------- rsmith wrote: > This is the wrong place for this check. We don't yet know whether the > function is virtual here in general. A function can become virtual due to > template instantiation: > > ``` > template<typename T> struct A : T { void f() requires true; }; > struct B { virtual void f(); }; > template struct A<B>; // error, A<B>::f is constrained and virtual > ``` > > This is perhaps a wording defect: it's not clear that `A::f()` really should > override `B::f()`, but that is the consequence of the current rules. I've > posted a question to the core reflector. I don't really see why A::f() should override B::f() indeed - since it is not marked virtual nor override, shouldn't it just hide B::f()? or am I missing something here? Repository: rC Clang https://reviews.llvm.org/D43357 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits