title: Avoid tautological-compare warning in template
body: <p>I have a template class that should return different values if the (unsigned) parameter is even or odd, like in this test case:</p>
  <pre><code>template &lt;unsigned X&gt; class t {
  public:
      static int get(int *n) {
          if constexpr (1 == (X &amp; 1))
              return n[X] + n[X-1] + t&lt;X-2&gt;::get(n);
          else
              return n[X] + t&lt;X-1&gt;::get(n);
      }
  };
  
  template &lt;&gt; class t&lt;1&gt; {
  public:
      static int get(int *n) {
          return n[0] + n[1];
      }
  };
  
  template &lt;&gt; class t&lt;0&gt; {
  public:
      static int get(int *n) {
          return n[0];
      }
  };
  
  int main() {
      int x[9] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
      return t&lt;8&gt;::get(x);
  }
  </code></pre>
  <p>This is part of a large code that uses vector instructions, so it processes more than one element at a time if possible.</p>
  <p>Problem is, newer GCC versions emit the following warning:</p>
  <pre><code>temp.cc: In instantiation of ‘static int t&lt;X&gt;::get(int*) [with unsigned int X = 8]’:
  temp.cc:27:18:   required from here
  temp.cc:4:25: warning: bitwise comparison always evaluates to false [-Wtautological-compare]
      4 |         if constexpr (1 == (X &amp; 1))
        |                       ~~^~~~~~~~~~
  </code></pre>
  <p>The warning is given regardless of adding the &quot;constexpr&quot; word.</p>
  <p>IMHO, GCC should not emit that warning here, as the code is not always false - only in the specific template specialization.</p>
  <p>Is there a way to avoid this warning without resorting to writing template specializations depending on another parameter?</p>