This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

bug report



Hi,

next code fragment gives me internal compiler error on
linux but syntax errors on sun.

1. 

stas:~/BETA $ uname -a
Linux stas 2.0.30 #1 Sun Jun 1 09:14:11 EST 1997 i586 unknown
stas:~/BETA $ c++ -v
Reading specs from
/home/kriol/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.90.05/specs
gcc version egcs-2.90.05 970904 (gcc2-970802 experimental)

this is Pentium box with Debian unstable (glibc 2.0.4)

ICR here


2. 

drabble /scratch/BETA$ uname -a
SunOS drabble 5.5.1 Generic_103640-08 sun4m sparc SUNW,SPARCstation-4
drabble /scratch/BETA$ c++ -v
Reading specs from
/home/room1/kriol/local/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.05/specs
gcc version egcs-2.90.05 970904 (gcc2-970802 experimental)

syntax error:

drabble /scratch/BETA$ c++ -c porder.cpp
porder.cpp: In function `int main()':
porder.cpp:28: no match for call to `(A<float>) (I<0> &, I<1> &)'
porder.cpp:19: candidates are: template <class T> template <int const N1,
int const N2> A<T>::operator ()(I<N1>, I<N2>)
porder.cpp:15:                 template <class T> template <class T1,
class T2> A<T>::operator ()(T1, T2)
porder.cpp:32: no match for call to `(A<float>) (float, double)'
porder.cpp:19: candidates are: template <class T> template <int const N1,
int const N2> A<T>::operator ()(I<N1>, I<N2>)
porder.cpp:15:                 template <class T> template <class T1,
class T2> A<T>::operator ()(T1, T2)

regards 

OK

--------------------------------------------------------------------

template<int N>
struct I {
};

template<class T>
struct A {

  int r;

  template<class T1, class T2>
  void operator()(T1, T2)
  { r = 0; }

  template<int N1, int N2>
  void operator()(I<N1>, I<N2>)
  { r = 1; }
};

int main()
{
    A<float> x;
    I<0> a;
    I<1> b;

    x(a,b);
    if (x.r != 1)
        return 1;

    x(float(), double());
    if (x.r != 0)
        return 1;

    return 0;
}




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]