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

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 1 14:04:55 PST 2023


cor3ntin added a comment.

@rupprecht

This expands to

  template <typename T>
  class MyMock {
    static_assert( static_assert( ::testing::tuple_size<typename ::testing::internal::Function< ::testing::internal::identity_t<int(double x, char c, bool cond)> >::ArgumentTuple>::value == 2, "This method does not take " "2" " arguments. Parenthesize all types with unprotected commas."); 
  };

(some stuff omitted)

Not getting the error here is the expected outcome of this change.
The committee considered that these scenarios were far less likely than the scenario where people did not want a diagnostic.
Instantiating `MyMock<int> T;` produces the warning.

I think this code can be changed to something like that https://godbolt.org/z/6bcrYfdTf - to partially recover the previous diagnostics.
If however we find this change to disruptive, we should inform WG21.


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