Compiling the code

  // start tmp.cpp
  template<class T,class S> struct A{};

  struct B
  {   
      void f(A<int,int> default_value=A<int,int>());
  };
  // end tmp.cpp

with

  g++ tmp.cpp

produces these errors

tmp.cpp:6: error: expected ‘,’ or ‘...’ before ‘>’ token
tmp.cpp:6: error: missing ‘>’ to terminate the template argument list
tmp.cpp:6: error: wrong number of template arguments (1, should be 2)
tmp.cpp:2: error: provided for ‘template<class T, class S> struct A’
tmp.cpp:6: error: expected ‘,’ before ‘int’

The errors disappear if
  1. The function is moved outside of the second struct definition.
  2. The second template argument to A is removed.
  3. The default argument is removed.
  4. A typedef is used to encapsulate A<int,int>.
  5. Comeau 4.3.3 is used.


-- 
           Summary: parse error for argument default whose type has two
                    template arguments
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: irving at cs dot stanford dot edu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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

Reply via email to