title: static variable initialization in template class
body: <p>Can anyone explain why this code is crashing? 
  The same behavior is on both windows with mingw and ubuntu.</p>
  
  <p>Per debugger the parameter "a" passed to constructor One is "optimized out".</p>
  
  <p>The crash happens when I try to access to static member two_;</p>
  
  <p>three.h</p>
  
  <pre><code>#ifndef THREE_H
  #define THREE_H
  #include &lt;string&gt;
  
  class One
  {
  public:
      One(const std::string&amp; a)
          : a_(a)
      {
  
      }
      std::string a_;
  };
  
  template&lt;typename P&gt;
  class Two : public One
  {
  public:
      Two()
          : One(P::name)
      {
  
      }
      std::string foo()
      {
          return a_;
      }
  };
  
  template&lt;typename T&gt;
  class Three
  {
  public:
      struct Info
      {
          static std::string name;
      };
      typedef Two&lt;Info&gt; Two_t;
      static Two_t two_;
  };
  
  template &lt; typename T &gt;
  std::string Three&lt;T&gt;::Info::name = std::string("aaaa");
  
  template &lt; typename T &gt;
  typename Three&lt;T&gt;::Two_t Three&lt;T&gt;::two_ = Three&lt;T&gt;::Two_t();
  
  
  #endif // THREE_H
  </code></pre>