Hi,
i played with templates and maybe found a bug in SunStudio. Source code is a bit longer so i place here link: [http://www.box.net/shared/3n0inz5348]
I don't intend to use it seriously, i just tested implementation of callbacks in C++. It uses partially specialized templates and templates with default parameters. In the beginning are macros which can be used to select which kind of functions will be tested.
#define STATIC_FUNCTIONS
//#define STATIC_MEMBER_FUNCTIONS
#define MEMBER_FUNCTIONS
#define CONST_MEMBER_FUNCTIONS
Some combinations are not possible because C++ does not allow them, but the combination above failed with compiler/linker error.
SunStudio 11 (CC: Sun C++ 5.8 Patch 121017-10 2007/02/21) failed during compilation with this output:
Assertion failed at line 1351 of ../src/omfi.c
*** Error code 1
SunStudio 12 (CC: Sun Ceres C++ 5.9 SunOS_sparc 2008/01/28) failed during linking with output:
ld: fatal: file Sun-sparc-Solaris/main.o: section .group%Callback<__type_1,__type_2>*makeCallback<Test,int,int>(__type_0&,__type_1): has invalid sh_link: 0
ld: fatal: file Sun-sparc-Solaris/main.o: section .group%Callback<__type_1,void>*makeCallback<Test,int>(__type_0&,__type_1): has invalid sh_link: 0
ld: fatal: file Sun-sparc-Solaris/main.o: section .group%Callback<void,void>*makeCallback<Test>(__type_0&,__type_1): has invalid sh_link: 0
ld: fatal: file Sun-sparc-Solaris/main.o: section .group%Callback<__type_1,__type_2>*makeCallback<Test,int,int>(__type_0&,__type_1): SHF_GROUP flag set, but no corresponding SHT_GROUP section found
ld: fatal: file Sun-sparc-Solaris/main.o: section .text%Callback<__type_1,__type_2>*makeCallback<Test,int,int>(__type_0&,__type_1): SHF_GROUP flag set, but no corresponding SHT_GROUP section found
ld: fatal: file Sun-sparc-Solaris/main.o: section .group%Callback<__type_1,void>*makeCallback<Test,int>(__type_0&,__type_1): SHF_GROUP flag set, but no corresponding SHT_GROUP section found
ld: fatal: file Sun-sparc-Solaris/main.o: section .text%Callback<__type_1,void>*makeCallback<Test,int>(__type_0&,__type_1): SHF_GROUP flag set, but no corresponding SHT_GROUP section found
ld: fatal: file Sun-sparc-Solaris/main.o: section .group%Callback<void,void>*makeCallback<Test>(__type_0&,__type_1): SHF_GROUP flag set, but no corresponding SHT_GROUP section found
ld: fatal: file Sun-sparc-Solaris/main.o: section .text%Callback<void,void>*makeCallback<Test>(__type_0&,__type_1): SHF_GROUP flag set, but no corresponding SHT_GROUP section found
ld: fatal: file Sun-sparc-Solaris/main.o: section .exception_ranges%Callback<__type_1,__type_2>*makeCallback<Test,int,int>(__type_0&,__type_1): SHF_GROUP flag set, but no corresponding SHT_GROUP section found
ld: fatal: file Sun-sparc-Solaris/main.o: section .exception_ranges%Callback<__type_1,void>*makeCallback<Test,int>(__type_0&,__type_1): SHF_GROUP flag set, but no corresponding SHT_GROUP section found
ld: fatal: file Sun-sparc-Solaris/main.o: section .exception_ranges%Callback<void,void>*makeCallback<Test>(__type_0&,__type_1): SHF_GROUP flag set, but no corresponding SHT_GROUP section found
ld: fatal: File processing errors. No output written to Sun-sparc-Solaris/test
*** Error code 1
If you think that it should be posted as a bug and if you understand my English :D post here any suggestions thanks.