llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Younan Zhang (zyn0217) <details> <summary>Changes</summary> This addresses comments from @<!-- -->Endilll in the post commit review of #<!-- -->110473. --- Full diff: https://github.com/llvm/llvm-project/pull/110842.diff 1 Files Affected: - (modified) clang/test/CXX/drs/cwg27xx.cpp (+32-32) ``````````diff diff --git a/clang/test/CXX/drs/cwg27xx.cpp b/clang/test/CXX/drs/cwg27xx.cpp index 581e2af822d556..cb08c17b4b3bef 100644 --- a/clang/test/CXX/drs/cwg27xx.cpp +++ b/clang/test/CXX/drs/cwg27xx.cpp @@ -2,9 +2,9 @@ // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++11 -pedantic-errors -verify=expected %s // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++14 -pedantic-errors -verify=expected %s // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++17 -pedantic-errors -verify=expected %s -// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++20 -pedantic-errors -verify=expected %s -// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++23 -pedantic-errors -verify=expected,since-cxx23 %s -// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++2c -pedantic-errors -verify=expected,since-cxx23,since-cxx26 %s +// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++20 -pedantic-errors -verify=expected,since-cxx20 %s +// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++23 -pedantic-errors -verify=expected,since-cxx20,since-cxx23 %s +// RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++2c -pedantic-errors -verify=expected,since-cxx20,since-cxx23,since-cxx26 %s #if __cplusplus == 199711L #define static_assert(...) __extension__ _Static_assert(__VA_ARGS__) @@ -29,6 +29,35 @@ namespace std { #endif } // namespace std +namespace cwg2707 { // cwg2707: 20 + +#if __cplusplus >= 202002L + +template <class T, unsigned N> struct A { // #cwg2707-A + T value[N]; +}; + +template <typename... T> +A(T...) -> A<int, sizeof...(T)> requires (sizeof...(T) == 2); // #cwg2707-guide-A + +// Brace elision is not allowed for synthesized CTAD guides if the array size +// is value-dependent. +// So this should pick up our explicit deduction guide. +A a = {1, 2}; + +A b = {3, 4, 5}; +// since-cxx20-error@-1 {{no viable constructor or deduction guide}} \ +// since-cxx20-note@#cwg2707-A {{candidate function template not viable}} \ +// since-cxx20-note@#cwg2707-A {{implicit deduction guide}} \ +// since-cxx20-note@#cwg2707-guide-A {{constraints not satisfied}} \ +// since-cxx20-note@#cwg2707-guide-A {{because 'sizeof...(T) == 2' (3 == 2) evaluated to false}} \ +// since-cxx20-note@#cwg2707-A {{candidate function template not viable}} \ +// since-cxx20-note@#cwg2707-A {{implicit deduction guide}} + +#endif + +} // namespace cwg2707 + namespace cwg2718 { // cwg2718: 2.7 struct B {}; struct D; @@ -200,32 +229,3 @@ static_assert(false, f().s); // since-cxx26-error@-1 {{static assertion failed: Hello}} #endif } // namespace cwg2798 - -namespace cwg2707 { // cwg2707: 20 - -#if __cplusplus >= 202002L - -template <class T, unsigned N> struct A { - T value[N]; -}; - -template <typename... T> -A(T...) -> A<int, sizeof...(T)> requires (sizeof...(T) == 2); - -// Brace elision is not allowed for synthesized CTAD guides if the array size -// is value-dependent. -// So this should pick up our explicit deduction guide. -A a = {1, 2}; - -A b = {3, 4, 5}; -// expected-error@-1 {{no viable constructor or deduction guide}} \ -// expected-note@-13 {{candidate function template not viable}} \ -// expected-note@-13 {{implicit deduction guide}} \ -// expected-note@-8 {{constraints not satisfied}} \ -// expected-note@-8 {{because 'sizeof...(T) == 2' (3 == 2) evaluated to false}} \ -// expected-note@-13 {{candidate function template not viable}} \ -// expected-note@-13 {{implicit deduction guide}} - -#endif - -} // namespace cwg2707 `````````` </details> https://github.com/llvm/llvm-project/pull/110842 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits