[PATCH] D147070: Improve requirement clause limitation on non templated function

2023-03-29 Thread Erich Keane via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGeeb753e5: Improve requirement clause limitation on non templated function (authored by erichkeane). Herald added a project: clang. Changed

[PATCH] D147070: Improve requirement clause limitation on non templated function

2023-03-28 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik added inline comments. Comment at: clang/test/CXX/dcl.decl/dcl.decl.general/p4-20.cpp:27 + +namespace GH61748 { +template Maybe a union case just for completeness: ``` template union U { void f() requires true; }; ``` CHANGES SINCE LAST ACTION

[PATCH] D147070: Improve requirement clause limitation on non templated function

2023-03-28 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik accepted this revision. shafik added a comment. LGTM Comment at: clang/lib/Sema/SemaDecl.cpp:11877 // member-declarator shall be present only if the declarator declares a // templated function ([dcl.fct]). if (Expr *TRC =

[PATCH] D147070: Improve requirement clause limitation on non templated function

2023-03-28 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment. Thanks for the double check on the review! I'm going to wait for the libcxx bot to come back (and for it to not be a commit at end of day!), but then will commit (unless there is new info). Comment at:

[PATCH] D147070: Improve requirement clause limitation on non templated function

2023-03-28 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added a comment. In D147070#4228303 , @erichkeane wrote: > Took Corentin's advice and tried to test the lambda condition. THIS made me > discover that we didn't properly implement this for lambdas at all! So this > patch NOW also implements

[PATCH] D147070: Improve requirement clause limitation on non templated function

2023-03-28 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments. Comment at: clang/test/Parser/cxx2b-lambdas.cpp:21 auto L12 = [] consteval {}; -auto L13 = []() requires true {}; +auto L13 = []() requires true {}; // expected-error{{non-templated function cannot have a requires clause}} auto L14 = []

[PATCH] D147070: Improve requirement clause limitation on non templated function

2023-03-28 Thread Erich Keane via Phabricator via cfe-commits
erichkeane updated this revision to Diff 509101. erichkeane added a comment. Took Corentin's advice and tried to test the lambda condition. THIS made me discover that we didn't properly implement this for lambdas at all! So this patch NOW also implements the restriction for lambdas.

[PATCH] D147070: Improve requirement clause limitation on non templated function

2023-03-28 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments. Comment at: clang/lib/Sema/SemaDecl.cpp:11886-11887 + // - an enumerator for an enumeration that is a templated entity, or + // - the closure type of a lambda-expression ([expr.prim.lambda.closure]) + // appearing in the

[PATCH] D147070: Improve requirement clause limitation on non templated function

2023-03-28 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added a comment. LGTM except the arguably missing tests. Comment at: clang/lib/Sema/SemaDecl.cpp:11886-11887 + // - an enumerator for an enumeration that is a templated entity, or + // - the closure type of a lambda-expression ([expr.prim.lambda.closure]) +

[PATCH] D147070: Improve requirement clause limitation on non templated function

2023-03-28 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments. Comment at: clang/lib/Sema/SemaDecl.cpp:11898 + // defined... in a templated entity + !(DeclIsDefn && NewFD->isTemplated()) && + // a member of a templated entity Note we're using `isTemplated` here as

[PATCH] D147070: Improve requirement clause limitation on non templated function

2023-03-28 Thread Erich Keane via Phabricator via cfe-commits
erichkeane created this revision. erichkeane added reviewers: clang-language-wg, shafik. Herald added a project: All. erichkeane requested review of this revision. The current implementation 6da3d66f03f9162ef341cc67218be40e22fe9808