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]

Problem with template specialization and unions.



I have a problem with the following code (I think the code is correct):

union Un {int i;};

template<class T1, class T2> struct St1 {};
template<class T> struct St1<Un,T> {};

template<class T> struct St2 {};
template<> struct St2<Un> {};

template<class T1, class T2> struct St3 {};
template<> struct St3<Un,int> {};

int main() {
  St1<int,int> s1;
  St2<int>     s2;
  St3<int,int> s3;

  return 42;
}

for s1, egcs complains that:
union.cpp:14: sorry, not implemented: use of `union_type' in template type
unification

Which can indicate that the use of union type etc..., but it doesn't complains
for s2 and s3 !

So I don't know if it's just not implemented yet or if it's a bug in the
"unify" function.
You will the script in the remainder. I have the same problem with the 
latest egcs snapshot.

Thanks,

Alain

bash$ more union.cpp

union Un {int i;};

template<class T1, class T2> struct St1 {};
template<class T> struct St1<Un,T> {};

template<class T> struct St2 {};
template<> struct St2<Un> {};

template<class T1, class T2> struct St3 {};
template<> struct St3<Un,int> {};

int main() {
  St1<int,int> s1;
  St2<int>     s2;
  St3<int,int> s3;

  return 42;
}
bash$  /nfs/server4/miniussi/egcs/solar/bin/g++ union.cpp -c
union.cpp:14: sorry, not implemented: use of `union_type' in template type
unifica
tion
bash$ /nfs/server4/miniussi/egcs/solar/bin/g++ union.cpp -c -v
Reading specs from
/nfs/server4/miniussi/egcs/solar/lib/gcc-lib/sparc-sun-solaris2
.5.1/egcs-2.91.58/specs
gcc version egcs-2.91.58 19981101 (egcs-1.1.1 pre-release)

/nfs/server4/miniussi/egcs/solar/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.58/
cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus
-D__GNUC_MINOR__=9
1 -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__
-D__sv
r4__ -D__SVR4 -D__sparc -D__sun -D__unix -Asystem(unix) -Asystem(svr4)
-D__EXCEPTI
ONS -D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) union.cpp
/var/tmp/ccku8IJ
Z.ii
GNU CPP version egcs-2.91.58 19981101 (egcs-1.1.1 pre-release) (sparc)
#include "..." search starts here:
#include <...> search starts here:
 /nfs/server4/miniussi/egcs/solar/include/g++
 /usr/local/include
 /nfs/server4/miniussi/egcs/solar/sparc-sun-solaris2.5.1/include

/nfs/server4/miniussi/egcs/solar/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.58/
include
 /usr/include
End of search list.

/nfs/server4/miniussi/egcs/solar/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.58/
cc1plus /var/tmp/ccku8IJZ.ii -quiet -dumpbase union.cc -version -o
/var/tmp/ccI5hr
sU.s
GNU C++ version egcs-2.91.58 19981101 (egcs-1.1.1 pre-release)
(sparc-sun-solaris2
.5.1) compiled by GNU C version egcs-2.91.58 19981101 (egcs-1.1.1 pre-release).
union.cpp:14: sorry, not implemented: use of `union_type' in template type
unifica
tion
bash$ exit
exit

script done on Thu Dec 10 10:07:38 1998


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