Skip to content

[Clang][NFC] Add a test for CWG 2913 #110614

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

Merged
merged 2 commits into from
Oct 1, 2024
Merged

[Clang][NFC] Add a test for CWG 2913 #110614

merged 2 commits into from
Oct 1, 2024

Conversation

zyn0217
Copy link
Contributor

@zyn0217 zyn0217 commented Oct 1, 2024

I marked DR2913 as implemented in 915df1a, but I forgot to add a corresponding test, so running the script would fail thereafter.

I marked DR2913 as implemented in 915df1a, but I forgot to add a
corresponding test, so running the script would fail thereafter.
@zyn0217 zyn0217 added clang:frontend Language frontend issues, e.g. anything involving "Sema" skip-precommit-approval PR for CI feedback, not intended for review labels Oct 1, 2024
@zyn0217 zyn0217 requested a review from Endilll as a code owner October 1, 2024 01:18
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Oct 1, 2024
@llvmbot
Copy link
Member

llvmbot commented Oct 1, 2024

@llvm/pr-subscribers-clang

Author: Younan Zhang (zyn0217)

Changes

I marked DR2913 as implemented in 915df1a, but I forgot to add a corresponding test, so running the script would fail thereafter.


Full diff: https://github.com/llvm/llvm-project/pull/110614.diff

1 Files Affected:

  • (modified) clang/test/CXX/drs/cwg29xx.cpp (+20)
diff --git a/clang/test/CXX/drs/cwg29xx.cpp b/clang/test/CXX/drs/cwg29xx.cpp
index e55e8e35e86f28..1b086ba979ec51 100644
--- a/clang/test/CXX/drs/cwg29xx.cpp
+++ b/clang/test/CXX/drs/cwg29xx.cpp
@@ -6,6 +6,26 @@
 // RUN: %clang_cc1 -std=c++23 -pedantic-errors -verify=expected %s
 // RUN: %clang_cc1 -std=c++2c -pedantic-errors -verify=expected %s
 
+namespace cwg2913 { // cwg2913: 20
+
+#if __cplusplus >= 202002L
+
+template<typename T>
+struct R {
+  R(T);
+  R(T, T);
+};
+
+template<typename T>
+R(T) -> R<T> requires true;
+
+template<typename T>
+R(T, T) requires true -> R<T>; // expected-error {{expected function body after function declarator}}
+
+#endif
+
+} // namespace cwg2913
+
 namespace cwg2915 { // cwg2915: 20 tentatively ready 2024-08-16
 #if __cplusplus >= 202302L
 struct A {

@zyn0217
Copy link
Contributor Author

zyn0217 commented Oct 1, 2024

I'm merging now - feel free to do any post-commit review.

@zyn0217 zyn0217 merged commit 257707b into llvm:main Oct 1, 2024
8 checks passed
R(T) -> R<T> requires true;

template<typename T>
R(T, T) requires true -> R<T>; // expected-error {{expected function body after function declarator}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this diagnostic more friendly and actionable by stating that requires clause goes after the trailing return type, possibly suggesting a fix?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I’ll give it a try tomorrow

Sterling-Augustine pushed a commit to Sterling-Augustine/llvm-project that referenced this pull request Oct 3, 2024
I marked DR2913 as implemented in 915df1a, but I forgot to add a
corresponding test, so running the script would fail thereafter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category skip-precommit-approval PR for CI feedback, not intended for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants