<div dir="ltr"><div>Hi,</div><div><br></div><div>I have a class forwarding definition issue. For the following small test case, gcc can build pass, but clang(trunk) will build fail.</div><div><br></div><div>====================================</div><div><br></div><div>template<class T> class B;</div><div><br></div><div>template<class T></div><div>class A</div><div>{</div><div>  public:</div><div>    void f(void) const { B<double> e; g(e); }</div><div>    void g(B<double> &e) const;</div><div>};</div><div><br></div><div>template<class T></div><div>class B</div><div>{</div><div>public:</div><div>  T x[9];</div><div><br></div><div>  B() {</div><div>    for(int i=0;i<9;i++) x[i]=0;</div><div>  }</div><div>};</div><div>$ g++ -std=c++03 -c tt.cc</div><div>$ clang++ -std=c++03 -c tt.cc</div><div>tt.cc:7:36: error: implicit instantiation of undefined template 'B<double>'</div><div>    void f(void) const { B<double> e; g(e); }</div><div>                                   ^</div><div>tt.cc:1:25: note: template is declared here</div><div>template<class T> class B;</div><div>                        ^</div><div>1 error generated.</div><div><br></div><div><div>====================================</div></div><div><br></div><div>Is this bug in clang?</div><div><br></div><div>If not, how should I write the forwarding declaration for class B, and why gcc can pass?</div><div><br></div><div>Thanks,</div><div>-Jiangning</div></div>