-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[Clang] Implement CWG 2707 "Deduction guides cannot have a trailing requires-clause" #110473
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
Changes from all commits
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 |
---|---|---|
|
@@ -201,3 +201,31 @@ static_assert(false, f().s); | |
#endif | ||
} // namespace cwg2798 | ||
|
||
namespace cwg2707 { // cwg2707: 20 | ||
|
||
#if __cplusplus >= 202002L | ||
|
||
template <class T, unsigned N> struct A { | ||
T value[N]; | ||
}; | ||
|
||
template <typename... T> | ||
A(T...) -> A<int, sizeof...(T)> requires (sizeof...(T) == 2); | ||
|
||
// Brace elision is not allowed for synthesized CTAD guides if the array size | ||
// is value-dependent. | ||
// So this should pick up our explicit deduction guide. | ||
A a = {1, 2}; | ||
|
||
A b = {3, 4, 5}; | ||
// expected-error@-1 {{no viable constructor or deduction guide}} \ | ||
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. Expected directives should reflect the |
||
// expected-note@-13 {{candidate function template not viable}} \ | ||
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. DR tests indeed use relative offsets, but they very intentionally avoid making readers count lines to figure out which line the diagnostic is attached to. This should be converted to bookmarks. |
||
// expected-note@-13 {{implicit deduction guide}} \ | ||
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. Notes should be indented relative to the error directive they attach to. |
||
// expected-note@-8 {{constraints not satisfied}} \ | ||
// expected-note@-8 {{because 'sizeof...(T) == 2' (3 == 2) evaluated to false}} \ | ||
// expected-note@-13 {{candidate function template not viable}} \ | ||
// expected-note@-13 {{implicit deduction guide}} | ||
|
||
#endif | ||
|
||
} // namespace cwg2707 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the number of the Core issue, this test should've been placed towards the beginning of the file. We keep them in the ascending order.