// Just compile the following source

struct A {
  template <int n> int get_n() { return n; }
};

template <int n>
struct B {
  template <int m> int get_nm() { return n + m; }
};

struct C {
  template <int n>
  int get_n() { A a; return a.get_n<n>(); }

  template <int n>
  struct D {
    int get_n()
    {
      A a;
      return a.get_n<n>(); // Parse error here. It works under g++ 3.4
      // Workaround: return a.A::get_n<n>();
    }
    
    template <int m>
    int get_nm() { return n + m; }

    template <int m>
    int t() { return n + m; }
  };
  
  template <int n, int m>
  int get_nm() { B<n> b; return b.get_nm<m>(); }
  
  template <int n, int m>
  void t_m()
  {
    D<n> wm;
    wm.t<m>(); // parse error here
    // Workaround: change function name form `t_m' to `t' !?!
  }
};

int main()
{
  A a;
  B<1> b;
  C c;
  C::D<2> d;
  a.get_n<2>();
  b.get_nm<2>();
  c.get_n<2>();
  d.get_n();
  c.t_m<1,2>();
  return 0;
}

-- 
           Summary: Parse error in calls to template function members
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dummy1 at gazeta dot pl
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i486-pc-linux-gnu
  GCC host triplet: i486-pc-linux-gnu
GCC target triplet: i486-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19054

Reply via email to