boost template causing error gcc --version gcc (GCC) 4.0.1 20050831 (Red Hat 4.0.1-12) Copyright (C) 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. /usr/include/boost/detail/sp_counted_impl.hpp: In member function ‘virtual void* boost::detail::sp_counted_impl_pd<P, D>::get_deleter(const std::type_info&)’: /usr/include/boost/detail/sp_counted_impl.hpp:147: error: ‘mpl_::bool_<false>::value’ is not a valid template argument for type ‘bool’ because it is a non-constant expression /usr/include/boost/detail/sp_counted_impl.hpp:147: error: ‘mpl_::bool_<false>::value’ is not a valid template argument for type ‘bool’ because it is a non-constant expression ../inc/layermanager.hxx: In member function ‘void presentation::internal::LayerManager::forEachShape(const Functor&) const’: ../inc/layermanager.hxx:299: error: ‘mpl_::bool_<false>::value’ is not a valid template argument for type ‘bool’ because it is a non-constant expression ../inc/layermanager.hxx:299: error: ‘mpl_::bool_<false>::value’ is not a valid template argument for type ‘bool’ because it is a non-constant expression ../inc/layermanager.hxx: In member function ‘void presentation::internal::LayerManager::forEachShape(const Functor&)’: ../inc/layermanager.hxx:333: error: ‘mpl_::bool_<false>::value’ is not a valid template argument for type ‘bool’ because it is a non-constant expression ../inc/layermanager.hxx:333: error: ‘mpl_::bool_<false>::value’ is not a valid template argument for type ‘bool’ because it is a non-constant expression
Created attachment 9645 [details] testcase I'm sure this worked very recently
This works for me on both the mainline and the 4.0 branch. And 4.0.0. Since this is a redhat specific version of GCC, please report it to them instead as it works with FSF released GCC.
I can reproduce it on a (freshly updated) stock gcc-4_0-branch: ./cc1plus --version; ./cc1plus -quiet -m32 testcase.ii GNU C++ version 4.0.2 20050902 (prerelease) (x86_64-unknown-linux-gnu) compiled by GNU C version 4.0.1 20050727 (Red Hat 4.0.1-5). GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=127988 /usr/include/boost/detail/sp_counted_impl.hpp: In member function irtual void* boost::detail::sp_counted_impl_pd<P, D>::get_deleter(const std::type_info&)': /usr/include/boost/detail/sp_counted_impl.hpp:147: error: pl_::bool_<false>::value' is not a valid template argument for type ool' because it is a non-constant expression /usr/include/boost/detail/sp_counted_impl.hpp:147: error: pl_::bool_<false>::value' is not a valid template argument for type ool' because it is a non-constant expression ../inc/layermanager.hxx: In member function oid presentation::internal::LayerManager::forEachShape(const Functor&) const': ../inc/layermanager.hxx:299: error: pl_::bool_<false>::value' is not a valid template argument for type ool' because it is a non-constant expression ../inc/layermanager.hxx:299: error: pl_::bool_<false>::value' is not a valid template argument for type ool' because it is a non-constant expression ../inc/layermanager.hxx: In member function oid presentation::internal::LayerManager::forEachShape(const Functor&)': ../inc/layermanager.hxx:333: error: pl_::bool_<false>::value' is not a valid template argument for type ool' because it is a non-constant expression ../inc/layermanager.hxx:333: error: pl_::bool_<false>::value' is not a valid template argument for type ool' because it is a non-constant expression FYI, gcc/cp/ of gcc-4_0-branch and gcc-4_0-rhl-branch is identical. If I revert http://gcc.gnu.org/ml/gcc-cvs/2005-08/msg00946.html (aka PR c++/23099 fix), the problem goes away.
(In reply to comment #3) > FYI, gcc/cp/ of gcc-4_0-branch and gcc-4_0-rhl-branch is identical. Then can Redhat's version.c updated to reflect that since it is annoying to have 4.0.1 seen when it is really a 4.0.2 and I tested a pretty new 4.0.2 which is why I got this wrong.
Well, it is not 4.0.2, as 4.0.2 has not been released. FSF version.c contains prerelease string which somewhat explains that it is really not yet official 4.0.2, but we use the version also for rpm version where claiming the compiler is 4.0.2 would be misleading. It is something between 4.0.1 and 4.0.2. For any RH version.c, the date printed is the date of merge from the corresponding upstream gcc-X_Y-branch which is I guess the most important info for you. This bug is actually something I asked Caolan to file here, because I knew there were no C++ changes between the 2 compilers where it broke other than the changes brought from a new gcc-4_0-branch merge.
(In reply to comment #5) > Well, it is not 4.0.2, as 4.0.2 has not been released. FSF version.c contains > prerelease string which somewhat explains that it is really not yet official > 4.0.2, but we use the version also for rpm version where claiming the compiler is > 4.0.2 would be misleading. It is something between 4.0.1 and 4.0.2. > For any RH version.c, the date printed is the date of merge from the > corresponding upstream gcc-X_Y-branch which is I guess the most important > info for you. Actually using 4.0.1 is more confusing to everyone or at least to me. The point is using 4.0.2 is like everyone else does and for a reason. It is based off of a FSF CVS after 4.0.1 was released and not on 4.0.1 itself. Seeing 4.0.1 I just tested a 4.0.2 (from about a week or so ago) which I had lying around. Just change it to 4.0.2 like everyone else and then when anyone sees 4.0.2, they will go and test a recent 4.0.2 instead of a 4.0.2 which was a couple weeks old. Anyways this is a discussion should really be internal to redhat since it was their fuck which made me make the mistake.
Anyways reducing.
I have to re-reduce this because I found a different bug as I reduced it too far, see PR 23698 for that bug.
Hmm I think the reason why this is accepted on the mainline is the same reason why PR 23698 is accepted.
Confirmed and htere is the reduced testcase: namespace std { class type_info { bool operator==(const type_info& __arg) const; }; } template <class T, T val> struct integral_constant { static const T value = val; }; template< typename T > struct is_integral : integral_constant<bool,false> {}; template <bool B> struct enable_if_c {}; template<typename Functor> typename enable_if_c<(is_integral<Functor>::value)>::type operator==(const int& f, Functor g); template<class D> int get_deleter( std::type_info const & ti ) { return ti == typeid(D); } The different between this and PR 23698 is indirectness of value in is_integral, this one goes though a base class while the other one does not. This test unlike the one in PR 23698 is accepted Comeau.
This is actually a duplicate of PR 23771. It compiles fine with 4.0.1pre but doesn't anymore with today's 4.0.2pre. W. *** This bug has been marked as a duplicate of 23771 ***
(In reply to comment #11) > This is actually a duplicate of PR 23771. It compiles fine with 4.0.1pre > but doesn't anymore with today's 4.0.2pre. Actually it is not really as this one works on the mainline.
Subject: Bug 23691 CVSROOT: /cvs/gcc Module name: gcc Changes by: mmitchel@gcc.gnu.org 2005-09-08 18:56:50 Modified files: gcc/cp : ChangeLog decl2.c gcc/testsuite : ChangeLog Log message: PR c++/23691 * decl2.c (mark_used): Instantiate static data members initialized by constants, even in a template. PR c++/23691 * g++.dg/template/static16.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4878&r2=1.4879 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl2.c.diff?cvsroot=gcc&r1=1.797&r2=1.798 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.6031&r2=1.6032
Subject: Bug 23691 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: mmitchel@gcc.gnu.org 2005-09-08 18:58:38 Modified files: gcc/cp : ChangeLog decl2.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: static16.C Log message: PR c++/23691 * decl2.c (mark_used): Instantiate static data members initialized by constants, even in a template. PR c++/23691 * g++.dg/template/static16.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.4648.2.95&r2=1.4648.2.96 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl2.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.770.2.5&r2=1.770.2.6 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.390&r2=1.5084.2.391 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/static16.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
Fixed in 4.0.2.
*** Bug 23771 has been marked as a duplicate of this bug. ***
Subject: Bug 23691 CVSROOT: /cvs/gcc Module name: gcc Changes by: mmitchel@gcc.gnu.org 2005-09-12 19:00:57 Modified files: gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: static16.C Log message: PR c++/23691 * g++.dg/template/static16.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.6048&r2=1.6049 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/static16.C.diff?cvsroot=gcc&r1=1.1&r2=1.2