|
1 | 1 | // UNSUPPORTED: target={{.*}}-zos{{.*}}
|
2 |
| -// RUN: %clang_cc1 -std=c++20 -fsyntax-only -fcxx-exceptions -verify=ref20,all,all20 %s |
3 |
| -// RUN: %clang_cc1 -std=c++23 -fsyntax-only -fcxx-exceptions -verify=ref23,all %s |
| 2 | +// RUN: %clang_cc1 -std=c++20 -fsyntax-only -fcxx-exceptions -verify=ref,ref20,all,all20 %s |
| 3 | +// RUN: %clang_cc1 -std=c++23 -fsyntax-only -fcxx-exceptions -verify=ref,ref23,all %s |
4 | 4 | // RUN: %clang_cc1 -std=c++20 -fsyntax-only -fcxx-exceptions -verify=expected20,all,all20 %s -fexperimental-new-constant-interpreter
|
5 | 5 | // RUN: %clang_cc1 -std=c++23 -fsyntax-only -fcxx-exceptions -verify=expected23,all %s -fexperimental-new-constant-interpreter
|
6 | 6 |
|
@@ -200,3 +200,15 @@ namespace UndefinedThreeWay {
|
200 | 200 | static_assert(!(*test_a_threeway)(A(), A())); // all-error {{static assertion expression is not an integral constant expression}} \
|
201 | 201 | // all-note {{undefined function 'operator<=>' cannot be used in a constant expression}}
|
202 | 202 | }
|
| 203 | + |
| 204 | +/// FIXME: The new interpreter is missing the "initializer of q is not a constant expression" diagnostics.a |
| 205 | +/// That's because the cast from void* to int* is considered fine, but diagnosed. So we don't consider |
| 206 | +/// q to be uninitialized. |
| 207 | +namespace VoidCast { |
| 208 | + constexpr void* p = nullptr; |
| 209 | + constexpr int* q = static_cast<int*>(p); // all-error {{must be initialized by a constant expression}} \ |
| 210 | + // all-note {{cast from 'void *' is not allowed in a constant expression}} \ |
| 211 | + // ref-note {{declared here}} |
| 212 | + static_assert(q == nullptr); // ref-error {{not an integral constant expression}} \ |
| 213 | + // ref-note {{initializer of 'q' is not a constant expression}} |
| 214 | +} |
0 commit comments