hubert-reinterpretcast wrote:

> Some more thought is needed on how to handle the non-`__builtin_`-prefixed 
> cases under non-C++23-or-higher language modes. The specific implications of 
> those functions being non-`constexpr` under said modes (as required, for C++, 
> by https://wg21.link/constexpr.functions) may determine the solution to apply 
> in this PR.

It seems that Clang _does_ care whether or not a function is `constexpr` 
(outside of an actual attempt to evaluate it during constant evaluation) when 
it is trying to diagnose the pre-C++23 IFNDR situation of a `constexpr` 
function that never produces a constant expression: 
https://godbolt.org/z/hnfqrrrdM

```cpp
extern "C" double fmin(double, double); // expected-note {{declared here}}
constexpr double contrived() { return fmin(0., 0.); }
// expected-error@-1 {{constexpr function never produces a constant expression}}
// expected-note@-2 {{non-constexpr function 'fmin' cannot be used in a 
constant expression}}
```

Aside: Clang checks the arguments before the function declaration.


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

Reply via email to