[clang] [clang] Fix potential constant expression checking with constexpr-unknown. (PR #149227)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 28 12:02:08 PDT 2025


efriedma-quic wrote:

And a few more:

```
constexpr auto& type(const PolyBase& b) { return typeid(b); }

// dynamic_cast
constexpr const void* dyncast(const PolyBase& b) { return dynamic_cast<const void*>(&b); }

constexpr int sub(int (&a)[], int (&b)[]) { return a-b; }

constexpr int* add(int &a) { return &a+10; }
```

I'll take another look at this... but I think we just have to explicitly suppress the diagnostic in all the relevant cases.  Which is a bit of a pain, but I don't see an alternative.

https://github.com/llvm/llvm-project/pull/149227


More information about the cfe-commits mailing list