Sunday, 15 March 2015

c++11 - clang recursive type derivation error for template members -


This code is usually compiled with gcc 4.8 and higher, but Not by clang ++ 3.5 and higher instead:

! Error: 'data & lt; Data & lt; Double, double & gt;, data & lt; Double, double & gt; & Gt; 'Data & lt; Double, double 'gt; '

This means that only one example was generated for func (data & lt; double, double & gt;).

Why neglected nested structures?

Is this a bug in rub? Or go away from the GCC standard?

  template & lt; Class T1, Class T2 & gt; Structure data {T1 T1; T2T2; Data (T1T1, T2T2): T1 (T1), T2 (T2) {}}; Template & lt; Class T1, Square T2 & gt; The data is & lt; T1, T2 & gt; Make_Data (T1 t1, T2 t2) {Return Data & lt; T1, T2 & gt; (T1, t2);} straight foo {template & lt; Class T & gt; Static Double Funk (Constant T & T) {Return 0.1 * T;} Template & lt; Class T1, Square T2 & gt; Fixed Auto Funk (Constant Data & lt; T1, T2 & gt; & amp; D) - & gt; DeliType (make_data (funk (dt1), throw (dt2)) {return macadata (throw (dt 1), throw (dt2));}}; Template & lt; Class T & gt; Auto apply_func (const T & amp; t) - & gt; Decltype (foo :: func (t)) {return Foo :: func (t);} int main () {auto data = make_Data (make_Data (1,2), make_Data (3,4)); Auto Data 1 = Application_Funk (data); Return 0; }  

As my struct foo template

  template & lt; Class T & gt; Structure FU {stable double function (CONST T & T) {return 0.1 * t;}}; Template & lt; Class T & gt; Auto apply_func (CONST T & T) - & gt; Deltipype (Foo & Lt; T & AC; :: Funk (T)) Foo & TT; T & AG :: Funk (T);} Template & lt; Class T1, Class T2 & gt; Static Auto Funk (Contact Data & lt; T1, T2 & gt; & amp; D) - & gt; Delitype (make_Data (apply_func (d.t1), apply_func (d.t2)) {FTA, returning_a_data (upper_funk (D. 1), applied_funk (D.2));}};  

But the whis case function should be used in the apply_func implementation and should be declared before class specialization.


No comments:

Post a Comment