title: ODR violation with template specializations
body: <p>We have a header file which contains some residuals for various floating point precisions:</p>
  
  <pre><code>template &lt;typename T&gt;
  struct rsdTarget {
    static const double value;
  };
  
  template &lt;&gt;
  const double rsdTarget&lt;half&gt;::value = (double)(1.0e-3);
  
  template &lt;&gt;
  const double rsdTarget&lt;float&gt;::value = (double)(1.0e-7);
  
  template &lt;&gt;
  const double rsdTarget&lt;double&gt;::value = (double)(1.0e-12);
  </code></pre>
  
  <p>This has worked because this header had only been included in a single compilation unit. Now I try to use this header in multiple compilation units and I get linker errors stemming from the ODR:</p>
  
  <pre><code>CMakeFiles/tests_g.dir/random_gauge.cc.o:(.rodata+0x108): multiple definition of `rsdTarget&lt;double&gt;::value'
  CMakeFiles/tests_g.dir/clover_product.cc.o:(.rodata+0x548): first defined here
  </code></pre>
  
  <p>The initialization probably needs to go into a source file and be taken out of the header file. However it seems to be prohibited to but an <code>extern</code> in front of the <code>const double</code>.</p>
  
  <p>What would I have to do such that this works with multiple compilation units?</p>
  
  <h1>Update</h1>
  
  <p>I thought that solving this for <code>double</code> would fix it fully. However, there is a second non-literal type which I also have to carry through:</p>
  
  <pre><code>template &lt;typename T&gt;
  struct tolerance {
    static const QDP::Double small; // Always fail
  };
  
  template &lt;&gt;
  const QDP::Double tolerance&lt;half&gt;::small = QDP::Double(5.0e-3);
  
  template &lt;&gt;
  const QDP::Double tolerance&lt;float&gt;::small = QDP::Double(1.0e-6);
  
  template &lt;&gt;
  const QDP::Double tolerance&lt;double&gt;::small = QDP::Double(1.0e-7);
  </code></pre>
  
  <p>I cannot seem to use that with <code>constexpr</code> because that type does not support it (<code>constexpr</code> ctor needed, right?). Which of the solutions works with this as well?</p>