File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,27 @@ static_assert(__builtin_structured_binding_size(P1) == 0);
101
101
// expected-note@#note-private {{implicitly declared private here}}
102
102
103
103
104
+ void func (int array[14 ], int x = __builtin_structured_binding_size(decltype (array)));
105
+ // expected-error@-1 {{type 'decltype(array)' (aka 'int *') cannot be decomposed}}
106
+
107
+ struct SM {
108
+ static int array[14 ];
109
+ static_assert (__builtin_structured_binding_size(decltype (array)) == 14 );
110
+ };
111
+
112
+ template <typename Ty, int N = __builtin_structured_binding_size(Ty)> // #tpl-1
113
+ struct T {
114
+ static constexpr int value = N;
115
+ };
116
+
117
+ T<int > t1;
118
+ // expected-error@#tpl-1 {{type 'int' cannot be decomposed}} \
119
+ // expected-error@#tpl-1 {{non-type template argument is not a constant expression}} \
120
+ // expected-note@-1 {{in instantiation of default argument for 'T<int>' required here}} \
121
+ // expected-note@-1 {{while checking a default template argument used here}} \
122
+
123
+ static_assert (T<S3>::value == 3 );
124
+
104
125
static_assert (is_destructurable<S0>);
105
126
static_assert (is_destructurable<const S0>);
106
127
static_assert (is_destructurable<volatile S0>);
You can’t perform that action at this time.
0 commit comments