|
2 | 2 | // RUN: %clang_cc1 -fsyntax-only -verify -std=c99 -ffreestanding %s
|
3 | 3 | // RUN: %clang_cc1 -fsyntax-only -verify -std=c11 -ffreestanding %s
|
4 | 4 | // RUN: %clang_cc1 -fsyntax-only -verify -std=c23 -ffreestanding %s
|
5 |
| -// RUN: %clang_cc1 -fsyntax-only -verify -std=c23 -ffreestanding -ffinite-math-only %s |
| 5 | +// RUN: %clang_cc1 -fsyntax-only -verify=finite -std=c23 -ffreestanding -ffinite-math-only %s |
6 | 6 | // RUN: %clang_cc1 -fsyntax-only -verify -xc++ -std=c++11 -ffreestanding %s
|
7 | 7 | // RUN: %clang_cc1 -fsyntax-only -verify -xc++ -std=c++14 -ffreestanding %s
|
8 | 8 | // RUN: %clang_cc1 -fsyntax-only -verify -xc++ -std=c++17 -ffreestanding %s
|
9 | 9 | // RUN: %clang_cc1 -fsyntax-only -verify -xc++ -std=c++23 -ffreestanding %s
|
| 10 | +// NOTE: C++23 wasn't based on top of C23, so it gets no diagnostics for |
| 11 | +// finite-math-only mode as happens in C. When C++ rebased onto C23, that |
| 12 | +// is when we'll issue diagnostics for INFINITY and NAN use. |
10 | 13 | // RUN: %clang_cc1 -fsyntax-only -verify -xc++ -std=c++23 -ffreestanding -ffinite-math-only %s
|
11 | 14 | // expected-no-diagnostics
|
12 | 15 |
|
|
218 | 221 | #ifndef NAN
|
219 | 222 | #error "Mandatory macro NAN is missing."
|
220 | 223 | #endif
|
| 224 | + // FIXME: the NAN diagnostic should only be issued once, not twice. |
| 225 | + _Static_assert(_Generic(INFINITY, float : 1, default : 0), ""); // finite-warning {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point options}} |
| 226 | + _Static_assert(_Generic(NAN, float : 1, default : 0), ""); // finite-warning {{use of NaN is undefined behavior due to the currently enabled floating-point options}} \ |
| 227 | + finite-warning {{use of NaN via a macro is undefined behavior due to the currently enabled floating-point options}} |
221 | 228 | #else
|
222 | 229 | #ifdef INFINITY
|
223 | 230 | #error "Macro INFINITY should not be defined."
|
|
0 commit comments