bug2

D Maley d.maley@stmarys-belfast.ac.uk
Wed May 12 03:37:00 GMT 1999


With the (stripped down) code below, I can't seem to win:


template <typename T, typename T1>
class X {
public:
  template <typename Derived>
  class Y : public Derived::Base::X<T, T1>::Y<typename Derived::Base> {
  };
};

template <typename T1>
class X<int, T1> {
public:
  template <typename Derived>
  class Y : public Derived::Base::X<T1>::Y<typename Derived::Base> {
  };
};

int main()
{
  return 0;
}

I get:

gcc -DXTFUNCPROTO -DSUN -w -falt-external-templates -I/usr/openwin/include
-I/usr/dt/share/include -I.  -c -o test.o test.cpp 2>>err
*** Error code 1
make: Fatal error: Command failed for target `test.o'
test.cpp:14: wrong number of template arguments (1, should be 2)
test.cpp:3: provided for `template <class T, class T1> X<T,T1>'
test.cpp:14: confused by earlier errors, bailing out

but then if I change line 14 to

  class Y : public Derived::Base::X<int, T1>::Y<typename Derived::Base> {
  
I get

airforce1% mk
gcc -DXTFUNCPROTO -DSUN -w -falt-external-templates -I/usr/openwin/include
-I/usr/dt/share/include -I.  -c -o test.o test.cpp 2>>err
*** Error code 1
make: Fatal error: Command failed for target `test.o'
test.cpp:14: wrong number of template arguments (2, should be 1)
test.cpp:14: provided for `template <class T1> template <class Derived>
X<int,T1>::Y<Derived>'
test.cpp:14: confused by earlier errors, bailing out

I'm using

airforce1% gcc -v
Reading specs from /usr/local/lib/gcc-lib/i386-pc-solaris2.6/egcs-2.93.10/specs
gcc version egcs-2.93.10 19990228 (gcc2 ss-980929 experimental)

Its not vital, but I can't think of any other syntax options so it looks
like a problem.
 
                           |===================================|  --
                      I--, |    Dave Maley, Computer Manager   | --
                 -----U =| |   St. Mary's University College   |  --
                 | :) U =| | 191 Falls Road, Belfast, BT12 6FE | --
            -----'----U  | |___________________________________|  --
   @__      |)___()  'U  |______====____   \_________________|   --
  _,>/'_    [_/,-,\"--"---- // ,-,  ,-,\\\   |/ //,-,  ,-,  ,-,\\  
 (*) \(*)     ( 0 )====####// ( 0 )( 0 )''-  o  '( 0 )( 0 )( 0 )''


St. Mary's University College
191 Falls Road, Belfast, BT12 6FE
N. Ireland.
Tel: +44 1232 327678
Fax: +44 1232 333719



More information about the Gcc-bugs mailing list