[PATCH] D134145: [Clang] Implement fix for DR2628

Roy Jacobson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 19 14:05:14 PDT 2022


royjacobson updated this revision to Diff 461351.
royjacobson edited the summary of this revision.
royjacobson added a comment.

Add release note, slightly nicer test


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134145/new/

https://reviews.llvm.org/D134145

Files:
  clang/docs/ReleaseNotes.rst
  clang/lib/Sema/SemaTemplate.cpp
  clang/test/CXX/drs/dr26xx.cpp


Index: clang/test/CXX/drs/dr26xx.cpp
===================================================================
--- /dev/null
+++ clang/test/CXX/drs/dr26xx.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown %s -verify
+
+namespace dr2628 { // dr2628: yes
+
+template <bool A = false, bool B = false>
+struct foo {
+  constexpr foo() requires (!A && !B) = delete; // #DR2628_CTOR
+  constexpr foo() requires (A || B) = delete;
+};
+
+void f() {
+  foo fooable; // expected-error {{call to deleted}}
+  // expected-note@#DR2628_CTOR {{marked deleted here}}
+}
+
+}
Index: clang/lib/Sema/SemaTemplate.cpp
===================================================================
--- clang/lib/Sema/SemaTemplate.cpp
+++ clang/lib/Sema/SemaTemplate.cpp
@@ -2445,6 +2445,8 @@
                                       TInfo->getType(), TInfo, LocEnd, Ctor);
     Guide->setImplicit();
     Guide->setParams(Params);
+    if (Ctor && Ctor->getTrailingRequiresClause())
+      Guide->setTrailingRequiresClause(Ctor->getTrailingRequiresClause());
 
     for (auto *Param : Params)
       Param->setDeclContext(Guide);
Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -146,6 +146,10 @@
 - A SubstTemplateTypeParmType can now represent the pack index for a
   substitution from an expanded pack.
   `Issue 56099 <https://github.com/llvm/llvm-project/issues/56099>`_
+- Respect constructor constraints during class template argument deduction (CTAD).
+  This is the suggested resolution to CWG DR2628.
+  `Issue 57646 <https://github.com/llvm/llvm-project/issues/57646>`_
+  `Issue 43829 <https://github.com/llvm/llvm-project/issues/43829>`_
 
 
 Improvements to Clang's diagnostics


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134145.461351.patch
Type: text/x-patch
Size: 1808 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220919/61329db9/attachment.bin>


More information about the cfe-commits mailing list