title: How to make a concept fail with a custom error message (C++20)
body: <p>Concepts are great at pinpointing an error to the line of code where <em>&quot;a constraint was not satisfied&quot;</em>.</p>
  <p>I'm wondering, however, if it is possible to issue a custom informational message there. The upside of static_assert was exactly that possibility. Use case: Any library that wants to help the user in figuring out why a certain expression was not satisfying the constraints.</p>
  <p>Here is a simple example, just to have some code. You might argue that any half-decent 'user' must be able to figure out the compiler's note <em>&quot;because 'is_base_of&lt;Base, C&gt;' evaluated to false&quot;</em>, but more custom information could not hurt. There will be more complicated concepts for sure.</p>
  <pre><code>
  template&lt;typename B, typename D&gt; 
  concept is_base_of = std::is_base_of_v&lt;B, D&gt;;
  
  template &lt;typename T, is_base_of&lt;T&gt; BaseType&gt;
  struct BaseWrapper { };  
  
  int main() 
  {
      class Base {};
      class Derived : public Base {};
      class C {};
  
      using T1 = BaseWrapper&lt;Derived,Base&gt;;
      using T2 = BaseWrapper&lt;C,Base&gt;;         // fails right here, but a custom message would be nice
  }
  
  </code></pre>