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
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
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits