[PATCH] D144285: [Clang] Implement CWG2518 - static_assert(false)

Jordan Rupprecht via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 7 20:43:52 PST 2023


rupprecht added a comment.

In D144285#4163004 <https://reviews.llvm.org/D144285#4163004>, @cor3ntin wrote:

> If however we find this change to disruptive, we should inform WG21.

Thanks for the explanation, I think I understand the issue now. I got totally thrown off by the title -- it's not about literally writing `static_assert(false)`, it's about deferring `static_assert` evaluation to template instantiations. Being able to write `static_assert(false)` (or any falsy constant expression) is just the common use case for this.

So possibly the most trivial example of something that used to break, but now builds:

  template <typename>
  void Fail() {
      static_assert(false, "my assertion failed");
  }

... but will still fail as soon as you invoke `Fail<any_type>()` somewhere.

It doesn't look like there's a lot of impact from this, and the breakages are corner cases like this. It might be worth mentioning this one case to WG21 but I'm not sure what I would change about the wording.



================
Comment at: clang/www/cxx_dr_status.html:14915
   <tr class="open" id="2518">
     <td><a href="https://wg21.link/cwg2518">2518</a></td>
     <td>review</td>
----------------
Is it possible to make this link point to https://cplusplus.github.io/CWG/issues/2518.html? This link is inaccessible to anyone not on ISO.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144285/new/

https://reviews.llvm.org/D144285



More information about the cfe-commits mailing list