[PATCH] D134145: [Clang] Implement fix for DR2628
Roy Jacobson via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 19 14:07:11 PDT 2022
royjacobson updated this revision to Diff 461352.
royjacobson added a comment.
rebase on main
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
@@ -151,6 +151,10 @@
`Issue 57369 <https://github.com/llvm/llvm-project/issues/57369>`_
`Issue 57643 <https://github.com/llvm/llvm-project/issues/57643>`_
`Issue 57793 <https://github.com/llvm/llvm-project/issues/57793>`_
+- 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.461352.patch
Type: text/x-patch
Size: 1839 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220919/06dacd1e/attachment.bin>
More information about the cfe-commits
mailing list