title: candidate template ignored: substitution failure(error with clang but not g++)
body: <p>I have a problem of substitution failure, and answers of some similar questions do not help me.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>template&lt;int dim, int loop&gt;  
  class Reference{
  public:
     //...
     template&lt;int r, int c&gt; using matrix_t = int[r][c];
     Reference(const matrix_t&lt;dim, loop&gt; &amp;mat){}
  }; 
  
  template&lt;int dim, int loop&gt;
  class Partition{
      // ...
  public:
      // ...
      template&lt;int r, int c&gt; using matrix = int[r][c];
      template&lt;int r, int c&gt; void readPattern(const matrix&lt;r,c&gt; &amp;pattern)
      {
         // ...
      }
      // ...
  };
  </code></pre>
  
  <p>And I call this template function like so:</p>
  
  <pre><code>int main()
  {
     // ... 
     const int DENOISE_UR[3][4] = {/*...*/};
     Partition&lt;1,2&gt; partition;
     partition.readPattern(DENOISE_UR);
     // ...
  }
  </code></pre>
  
  <p>Using g++, it compiles.</p>
  
  <p>When using clang++(linux) to compile(<code>clang++ -std=c++11 xxx.cpp</code>), it resulted in the following compiling error:</p>
  
  <pre><code>error: no matching function for call to 'readPattern'
     note: candidate template ignored: substitution failure[ with r = 3, c = 4 ]
           template&lt;int r, int c&gt; void readPattern(const matrix&lt;r,c&gt; &amp;pattern)
  </code></pre>
  
  <p>Why?</p>