-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[Clang] Implement CWG2517 Useless restriction on use of parameter in constraint-expression #132919
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 7 commits
7905577
a3b573c
bbd033d
159505e
f5681cd
5a939a7
943ad73
e108f4c
5af23bf
0a09adf
9eef48a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -32,6 +32,26 @@ enum E2 : S<E2>::I { e }; | |||||||||||||||||||||||||||||
#endif | ||||||||||||||||||||||||||||||
} // namespace cwg2516 | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
namespace cwg2517 { // cwg2517: 21 | ||||||||||||||||||||||||||||||
#if __cplusplus >= 202302L | ||||||||||||||||||||||||||||||
imdj marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||
template<typename ArrayType> | ||||||||||||||||||||||||||||||
concept LargeArray = requires (ArrayType my_array) { | ||||||||||||||||||||||||||||||
requires my_array.size() > 5; | ||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||
Comment on lines
+38
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have a test for the cases where the expression is not a constant expression? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would this be covered by the tests we updated in llvm-project/clang/test/CXX/expr/expr.prim/expr.prim.req/nested-requirement.cpp Lines 41 to 54 in 5af23bf
|
||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
struct Big { | ||||||||||||||||||||||||||||||
constexpr int size() const { return 100; } | ||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
struct Small { | ||||||||||||||||||||||||||||||
constexpr int size() const { return 3; } | ||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
static_assert(LargeArray<Big>); | ||||||||||||||||||||||||||||||
static_assert(!LargeArray<Small>); | ||||||||||||||||||||||||||||||
#endif | ||||||||||||||||||||||||||||||
} // namespace cwg2517 | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
namespace cwg2518 { // cwg2518: 17 | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
#if __cplusplus >= 201103L | ||||||||||||||||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.