-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[Clang] Add warning message for C++17 alias template CTAD #133806
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 2 commits
dd97898
c48c4a6
01789a4
42a08fb
5299a58
df703ea
eec39e4
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -9896,7 +9896,9 @@ QualType Sema::DeduceTemplateSpecializationFromInitializer( | |||||
| if (auto *AliasTemplate = dyn_cast_or_null<TypeAliasTemplateDecl>( | ||||||
| TemplateName.getAsTemplateDecl())) { | ||||||
| Diag(Kind.getLocation(), | ||||||
| diag::warn_cxx17_compat_ctad_for_alias_templates); | ||||||
| getLangOpts().CPlusPlus20 | ||||||
|
||||||
| ? diag::compat_cxx20_ctad_for_alias_templates | ||||||
| : diag::compat_pre_cxx20_ctad_for_alias_templates); | ||||||
|
||||||
| // expected-warning@-2 {{class template argument deduction for alias templates is a C++20 extension}} |
diag::compat_cxx20_ctad_for_alias_templates:
| // expected-warning@-4 {{class template argument deduction for alias templates is incompatible with C++ standards before C++20}} |
Uh oh!
There was an error while loading. Please reload this page.
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.
@Sirraide while I get the "efficiency" here I am bit uncomfortable that as a reviewer it is no longer obvious what diagnostics I need to look for in tests and as we have seen here easy to overlook that we are not fully covering tests.
This feels very anti-ergonomic for code reviewers. Maybe worth discussing during wg meeting CC @AaronBallman
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.
I feel like that might mainly be because this is a new thing we just added. I personally don’t think it’s that big of a deal because the wording of compatibility warnings is very consistent as a result of this, so so long as it’s clear that this always generates something of the form ‘... incompatibile with C++ standards before C++XY’ and ‘... a C++XY extension’, you know what to look for.
Also, even if it adds another thing to be aware of, it also removes the need to check if the compatibility warning is actually written correctly and whether we’re checking for the right lang opt when we emit it etc. etc. (though of course that last part will only come into effect once #132348 is merged).