title: Could not find implicit value for evidence parameter of type scala.reflect.ClassManifest[T]
body: <p>It seems I don't understand something important, maybe about erasure (damn it).</p>
  
  <p>I have a method, which I wanted to create array of size <code>n</code> filled with values from <code>gen</code>:</p>
  
  <pre><code>def testArray[T](n: Int, gen: =&gt;T) {
    val arr = Array.fill(n)(gen)
    ...
  }
  </code></pre>
  
  <p>And use it, for example as:</p>
  
  <pre><code>testArray(10, util.Random.nextInt(10))
  </code></pre>
  
  <p>But I get error:</p>
  
  <pre><code>scala: could not find implicit value for evidence parameter of type scala.reflect.ClassManifest[T]
  val arr = Array.fill(n)(gen)
                         ^
  </code></pre>
  
  <p>Please, explain what I did wrong, why this error, and what kind of code it makes impossible?</p>