================
@@ -216,11 +244,18 @@ int compareit(float a, float b) {
 
 // no-inf-no-nan-warning@+2 {{use of infinity is undefined behavior due to the 
currently enabled floating-point options}}
 // no-inf-warning@+1 {{use of infinity is undefined behavior due to the 
currently enabled floating-point options}}
-  double y = i * numeric_limits<double>::infinity();
+  double y = i * std::numeric_limits<double>::infinity();
+
+  y = i * numeric_limits<double>::infinity(); // expected-no-diagnostics
 
 // no-inf-no-nan-warning@+2 {{use of infinity is undefined behavior due to the 
currently enabled floating-point options}}
 // no-inf-warning@+1 {{use of infinity is undefined behavior due to the 
currently enabled floating-point options}}
-  j = numeric_limits<float>::infinity();
+  j = std::numeric_limits<float>::infinity();
+
+  j = numeric_limits<float>::infinity(); // expected-no-diagnostics
+
+  y = infinity(); // expected-no-diagnostics
+
----------------
erichkeane wrote:

Ah, in that case it is that the same checking code is being called during 
instantiation, which it almost definitely has to be (to catch the dependent 
case).

So what you're getting is:

```
std::numeric_limits<T>::infinity(); << Diagnosed ONLY during "Phase 2" of 
template instantiation.
  std::numeric_limits<double>::infinity(); << Diagnosed BOTH during Phase1 and 
Phase2.
```

Unfortunately we don't have a GREAT way to suppress warnings in these cases if 
you don't have access to the actual TreeTransform calls.  Typically we'd try to 
put the diagnostic somewhere this is ONLY called in Phase1, plus do it again 
ONLY if transformation happened during Phase 2.

https://github.com/llvm/llvm-project/pull/123417
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to