Lines Matching defs:infinity
1 // Use of NAN macro will trigger a warning "infinity defined in macro" because
29 // RUN: %s -Wno-nan-infinity-disabled -menable-no-infs -std=c++23
32 // RUN: %s -Wno-nan-infinity-disabled -menable-no-nans -std=c++23
67 [[nodiscard]] static constexpr _Ty infinity() noexcept {
81 [[nodiscard]] static constexpr float infinity() noexcept {
89 [[nodiscard]] static constexpr double infinity() noexcept {
97 [[nodiscard]] static constexpr _Ty infinity() noexcept {
105 [[nodiscard]] static constexpr float infinity() noexcept {
113 [[nodiscard]] static constexpr double infinity() noexcept {
118 double infinity() { return 0; }
122 // no-inf-no-nan-warning@+2 {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point options}}
123 // no-inf-warning@+1 {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point options}}
126 // no-inf-no-nan-warning@+2 {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point options}}
127 // no-inf-warning@+1 {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point options}}
130 // no-inf-no-nan-warning@+4 {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point options}}
132 // no-inf-warning@+2 {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point options}}
137 // no-inf-no-nan-warning@+3 {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point options}}
138 // no-inf-warning@+2 {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point options}}
142 // no-inf-no-nan-warning@+2 {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point options}}
143 // no-inf-warning@+1 {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point options}}
146 // no-inf-no-nan-warning@+2 {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point options}}
147 // no-inf-warning@+1 {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point options}}
151 // no-inf-no-nan-warning@+3 {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point options}}
152 // no-inf-warning@+2 {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point options}}
156 // no-inf-no-nan-warning@+4 {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point options}}
158 // no-inf-warning@+2 {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point options}}
162 // no-inf-no-nan-warning@+2 {{use of infinity is undefined behavior due to the currently enabled floating-point options}}
163 // no-inf-warning@+1 {{use of infinity is undefined behavior due to the currently enabled floating-point options}}
170 // no-inf-no-nan-warning@+2 {{use of infinity is undefined behavior due to the currently enabled floating-point options}}
171 // no-inf-warning@+1 {{use of infinity is undefined behavior due to the currently enabled floating-point options}}
174 // no-inf-no-nan-warning@+2 {{use of infinity is undefined behavior due to the currently enabled floating-point options}}
175 // no-inf-warning@+1 {{use of infinity is undefined behavior due to the currently enabled floating-point options}}
182 // no-inf-no-nan-warning@+2 {{use of infinity is undefined behavior due to the currently enabled floating-point options}}
183 // no-inf-warning@+1 {{use of infinity is undefined behavior due to the currently enabled floating-point options}}
186 // These should NOT warn, since they are not using NaN or infinity.
221 // no-inf-no-nan-warning@+4 {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point option}}
223 // no-inf-warning@+2 {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point options}}
227 // no-inf-no-nan-warning@+2 {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point options}}
228 // no-inf-warning@+1 {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point options}}
232 // no-inf-no-nan-warning@+5 {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point options}}
234 // no-inf-warning@+3 {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point options}}
239 // no-inf-no-nan-warning@+4 {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point options}}
241 // no-inf-warning@+2 {{use of infinity via a macro is undefined behavior due to the currently enabled floating-point options}}
245 // no-inf-no-nan-warning@+2 {{use of infinity is undefined behavior due to the currently enabled floating-point options}}
246 // no-inf-warning@+1 {{use of infinity is undefined behavior due to the currently enabled floating-point options}}
247 double y = i * std::numeric_limits<double>::infinity();
249 y = i * numeric_limits<double>::infinity(); // expected-no-diagnostics
251 // no-inf-no-nan-warning@+2 {{use of infinity is undefined behavior due to the currently enabled floating-point options}}
252 // no-inf-warning@+1 {{use of infinity is undefined behavior due to the currently enabled floating-point options}}
253 j = std::numeric_limits<float>::infinity();
255 j = numeric_limits<float>::infinity(); // expected-no-diagnostics
257 y = infinity(); // expected-no-diagnostics