================ @@ -0,0 +1,117 @@ +// RUN: %clang_cc1 -std=c++2a -verify %s + +struct A { + int a, b[3], c; + bool operator==(const A&) const = default; +}; + +constexpr auto a0 = A{0, 0, 3, 4, 5}; + +// expected-note@+1 {{evaluates to '{0, {0, 3, 4}, 5} == {1, {2, 3, 4}, 5}'}} +static_assert(a0 == A{1, {2, 3, 4}, 5}); // expected-error {{failed}} + +struct _arr { + const int b[3]; + constexpr bool operator==(const int rhs[3]) const { + for (unsigned i = 0; i < sizeof(b) / sizeof(int); i++) + if (b[i] != rhs[i]) + return false; + return true; + } +}; + +// TODO[seth] syntactically sort of valid but almost entirely unusuable +// (it's an int *, not an int [3] ) +// constexpr int _[3] = {...}; would work, but that's not piecewise substitutable +// maybe it's ok? I mean, not like we can do better really... +constexpr auto _ = (int[3]){2, 3, 4}; + +// output: '{{2, 3, 4}} == {0, 3, 4}' (the `{{` breaks VerifyDiagnosticConsumer::ParseDirective) ---------------- sethp wrote:
Well, my bad idea [worked out easily enough](https://github.com/sethp/llvm-project/commit/153d36338a73d8fbbb6087b2cf07e671b7aa660a). I'm happy to roll that in to (or out of) this change: whatever y'all think is best. (I also seem to have confused the 'hub with an immaculately timed interrupt to the `git push`; that commit is on the appropriate branch in my fork, but hasn't shown up here on the PR yet. Maybe it will eventually? ¯\\_(ツ)_/¯ ) https://github.com/llvm/llvm-project/pull/74852 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits