GNOME Bugzilla – Bug 168261
gcc-3.2.3 build failure in is_base_and_derived<>
Last modified: 2005-06-12 21:11:23 UTC
Version details: 2.0.10 Distribution/Version: RHEL 3.0/x86 Encountered the following failure building with gcc-3.2.3: g++ -DHAVE_CONFIG_H -I.. -I.. -g -O2 -MT lambda.lo -MD -MP -MF .deps/lambda.Tpo -c adaptors/lambda/lambda.cc -fPIC -DPIC -o .libs/lambda.o ../sigc++/type_traits.h: In instantiation of `sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select1>': adaptors/lambda/lambda.cc:7: instantiated from `sigc::lambda<sigc::internal::lambda_select1>' adaptors/lambda/lambda.cc:7: instantiated from here ../sigc++/type_traits.h:118: invalid use of undefined type `struct sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select1> ' ../sigc++/type_traits.h:96: declaration of `struct sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select1> ' adaptors/lambda/lambda.cc: In instantiation of `sigc::lambda<sigc::internal::lambda_select1>': adaptors/lambda/lambda.cc:7: instantiated from here adaptors/lambda/lambda.cc:7: non-constant ` sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select1>::value' cannot be used as template argument ../sigc++/type_traits.h: In instantiation of `sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select2>': adaptors/lambda/lambda.cc:8: instantiated from `sigc::lambda<sigc::internal::lambda_select2>' adaptors/lambda/lambda.cc:8: instantiated from here ../sigc++/type_traits.h:118: invalid use of undefined type `struct sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select2> ' ../sigc++/type_traits.h:96: declaration of `struct sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select2> ' adaptors/lambda/lambda.cc: In instantiation of `sigc::lambda<sigc::internal::lambda_select2>': adaptors/lambda/lambda.cc:8: instantiated from here adaptors/lambda/lambda.cc:8: non-constant ` sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select2>::value' cannot be used as template argument ../sigc++/type_traits.h: In instantiation of `sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select3>': adaptors/lambda/lambda.cc:9: instantiated from `sigc::lambda<sigc::internal::lambda_select3>' adaptors/lambda/lambda.cc:9: instantiated from here ../sigc++/type_traits.h:118: invalid use of undefined type `struct sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select3> ' ../sigc++/type_traits.h:96: declaration of `struct sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select3> ' adaptors/lambda/lambda.cc: In instantiation of `sigc::lambda<sigc::internal::lambda_select3>': adaptors/lambda/lambda.cc:9: instantiated from here adaptors/lambda/lambda.cc:9: non-constant ` sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select3>::value' cannot be used as template argument ../sigc++/type_traits.h: In instantiation of `sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select4>': adaptors/lambda/lambda.cc:10: instantiated from `sigc::lambda<sigc::internal::lambda_select4>' adaptors/lambda/lambda.cc:10: instantiated from here ../sigc++/type_traits.h:118: invalid use of undefined type `struct sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select4> ' ../sigc++/type_traits.h:96: declaration of `struct sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select4> ' adaptors/lambda/lambda.cc: In instantiation of `sigc::lambda<sigc::internal::lambda_select4>': adaptors/lambda/lambda.cc:10: instantiated from here adaptors/lambda/lambda.cc:10: non-constant ` sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select4>::value' cannot be used as template argument ../sigc++/type_traits.h: In instantiation of `sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select5>': adaptors/lambda/lambda.cc:11: instantiated from `sigc::lambda<sigc::internal::lambda_select5>' adaptors/lambda/lambda.cc:11: instantiated from here ../sigc++/type_traits.h:118: invalid use of undefined type `struct sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select5> ' ../sigc++/type_traits.h:96: declaration of `struct sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select5> ' adaptors/lambda/lambda.cc: In instantiation of `sigc::lambda<sigc::internal::lambda_select5>': adaptors/lambda/lambda.cc:11: instantiated from here adaptors/lambda/lambda.cc:11: non-constant ` sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select5>::value' cannot be used as template argument ../sigc++/type_traits.h: In instantiation of `sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select6>': adaptors/lambda/lambda.cc:12: instantiated from `sigc::lambda<sigc::internal::lambda_select6>' adaptors/lambda/lambda.cc:12: instantiated from here ../sigc++/type_traits.h:118: invalid use of undefined type `struct sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select6> ' ../sigc++/type_traits.h:96: declaration of `struct sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select6> ' adaptors/lambda/lambda.cc: In instantiation of `sigc::lambda<sigc::internal::lambda_select6>': adaptors/lambda/lambda.cc:12: instantiated from here adaptors/lambda/lambda.cc:12: non-constant ` sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select6>::value' cannot be used as template argument ../sigc++/type_traits.h: In instantiation of `sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select7>': adaptors/lambda/lambda.cc:13: instantiated from `sigc::lambda<sigc::internal::lambda_select7>' adaptors/lambda/lambda.cc:13: instantiated from here ../sigc++/type_traits.h:118: invalid use of undefined type `struct sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select7> ' ../sigc++/type_traits.h:96: declaration of `struct sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select7> ' adaptors/lambda/lambda.cc: In instantiation of `sigc::lambda<sigc::internal::lambda_select7>': adaptors/lambda/lambda.cc:13: instantiated from here adaptors/lambda/lambda.cc:13: non-constant ` sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select7>::value' cannot be used as template argument make[3]: *** [lambda.lo] Error 1
BTW, it does build with gcc-3.3.2 and gcc-3.4.3.
Thanks. Do you know the most recent (if any) version that does build with this compiler?
2.0.6.
I'm not too worried as long as a version does build. You could try patching the is_base_and_derived struct locally if you need the few extra bugfixes since then. I'd be OK with a patch to add an "#ifdef 0" block with a comment that mentions the broken compilers explicitly. A compiler test (see below) might detect this too, but I'm not sure if it's worth it. The problem seems to be: ../sigc++/type_traits.h:118: invalid use of undefined type `struct sigc::is_base_and_derived<sigc::lambda_base, sigc::internal::lambda_select1> - in 2.0.6, the is_base_class() static methods were in an inner class of is_base_and_derived. - in 2.0.7+, they are in the is_base_and_derived class itself, without the inner class. In both cases, the class is not fully defined, and in no cases should that matter, because they are static.
Does this help?
Sorry, no time to look at this yet. Hopefully in a few weeks.
Same thing here with the Red Hat 9 compiler gcc 3.2.2 20030222 (Red Hat Linux 3.2.2-5) and libsigc++-2.0.11.
I also encountered the same problem while trying to build gnome-coaster on GARNOME 2.10.0.1 on my RHEL WS3 box. my gcc spec is: gcc (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-49) This is libsigc++ v2.0.10. Attaching configure + build failure log. I'll install an updated toolchain, much worth it imho than fixing code for broken compilers.
Created attachment 39746 [details] Configure + build log
Comment #4 (http://bugzilla.gnome.org/show_bug.cgi?id=168261#c4) still applies.
I'd like someone to at least create a simple C++ test case (without using libsigc++) to show this compiler problem. Then we can check for it in libsigc++'s configure step.
I have added comments in sigc++/type_traits.h to help someone create a patch. I'm not using g++ 3.2 so I can't do it for you.
I have made a patch for this. It is diffed against 2.0.14 as, from my observations, success of using `autogen.sh' for any package that you don't maintain, is close to 0%.
Created attachment 47644 [details] [review] The proposed patch.
Forgot the change log entry: 2005-06-12 Paul Pogonyshev <pogonyshev@gmx.net> * configure.ac: * scripts/cxx.m4: * sigc++config.h.in: Add test for whether the compiler allows referencing to member functions of the class/structure being declared from a definition of a static member variable. Supposedly a generic solution for GCC 3.2 compilation problems. * sigc++/type_traits.h: Define SIGC_WRAP_IS_BASE_CLASS_ based on results of the above test. (struct is_base_and_derived): Wrap up is_base_class_() functions in an internal class if SIGC_WRAP_IS_BASE_CLASS_ is defined.
Excellent. Thanks. I have committed this, but without the extra SIGC_WRAP_IS_BASE_CLASS_ define.