The error message is : /local_scratch/douze/gcc_cur/lib/gcc/i686-pc-linux-gnu/4.0.0/../../../../include/c++/4.0.0/bits/cpp_type_traits.h: In instantiation of 'std::__is_pod<std::less<int> >': /local_scratch/douze/gcc_cur/lib/gcc/i686-pc-linux-gnu/4.0.0/../../../../include/c++/4.0.0/bits/stl_tree.h:431: instantiated from 'std::_Rb_tree<int, std::pair<const int, A<0> >, std::_Select1st<std::pair<const int, A<0> > >, std::less<int>, std::allocator<std::pair<const int, A<0> > > >' /local_scratch/douze/gcc_cur/lib/gcc/i686-pc-linux-gnu/4.0.0/../../../../include/c++/4.0.0/bits/stl_map.h:124: instantiated from 'std::map<int, A<0>, std::less<int>, std::allocator<std::pair<const int, A<0> > > >' test7.cpp:5: instantiated from 'A<0>' test7.cpp:10: instantiated from here /local_scratch/douze/gcc_cur/lib/gcc/i686-pc-linux-gnu/4.0.0/../../../../include/c++/4.0.0/bits/cpp_type_traits.h:398: error: too many template parameter lists in declaration of 'std::__is_pod<std::less<int> >::<anonymous enum>' The error appears with gcc 3.4.1 and gcc 4.0.0, but not with 3.3.2
Created attachment 7973 [details] code that fails This code fails. Changing about anything in the code makes it work. The code compiles fine with intel's compiler.
I think this is a C++ front-end problem but I would need to reduce the failure. Also just a note the preprocessed from 3.4.0/4.0.0 is rejected for the same reason in 3.3.3 but accepted in 3.0.4.
Indeed, Andrew, it's *very* unlikely that this is libstdc++-v3 bug: I see a crazy error message about __is_pod, which is actually instantiated with the default std::less...
This is definitely a front-end issue, I have the reduced testcase down to about 60 lines, I want to reduce it a little further before posting.
: Search converges between 2002-10-04-trunk (#94) and 2002-10-05-trunk (#95).
Reduced testcase: template<typename _Tp> struct __is_pod { enum { _M_type }; }; template <typename _Key> struct map { static const bool _Is_pod_comparator = __is_pod<_Key >::_M_type; }; template <int a> struct A { static map<int> Cache; template <typename B> void f(B out); }; template <> template <typename B> void A <0> ::f ( B out) { }
One more note, libstdc++ headers changed to exposed this bug in the C++ front-end :(.
... if the c++ fe bug cannot be fixed in time for 4.0, we can consider reverting the library change, which (at variance with the version in v7-branch) is not really useful in the present form.
I'm surprised this is something that hasn't been found yet by one of our users. I'd vote to up its importance, it's a rejects-valid of the nasty kind since it's going to be almost impossible to work around it... W.
Further reduced testcase: ================================================== template<int> struct A { enum { e }; template<int> void foo(); }; template<> template<int> void A<0>::foo() {} ================================================== This is probably the same underlying problem as in PR14494. PR14494 can be reduced to ================================================== template<int> struct A { template<int> void foo(); }; template<> template<int N> void A<0>::foo<N>() {} ================================================== which results in the following bogus error message: PR14494A.cc:10: error: function template partial specialization 'foo<N>' is not allowed PR14494A.cc:10: error: no 'void A<0>::foo()' member function declared in class 'A<0>' PR14494A.cc:10: error: invalid function declaration A similar version is the following: ================================================== template<int> struct A { template<int> void foo(); }; template<> template<int> void A<0>::foo() {} ================================================== which results in the following bogus error message: PR14494B.cc:10: error: template-id 'foo<>' for 'void A<0>::foo()' does not match any template declaration PR14494B.cc:10: error: invalid function declaration Btw, the underlying problem is not a regression.
Related to PR14479.
Patch for 3.4 and 4.0 submitted: http://gcc.gnu.org/ml/gcc-patches/2005-01/msg01491.html
Subject: Bug 19487 CVSROOT: /cvs/gcc Module name: gcc Changes by: lerdsuwa@gcc.gnu.org 2005-02-12 15:40:29 Modified files: gcc/cp : ChangeLog cp-tree.h name-lookup.c pt.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: enum5.C Log message: PR c++/14479 PR c++/19487 * pt.c (maybe_check_template_type): Remove. * cp-tree.h (maybe_check_template_type): Remove prototype. * name-lookup.c (maybe_process_template_type_declaration): Don't use maybe_check_template_type. * g++.dg/template/enum5.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4624&r2=1.4625 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.1103&r2=1.1104 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.c.diff?cvsroot=gcc&r1=1.108&r2=1.109 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.975&r2=1.976 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5025&r2=1.5026 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/enum5.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 19487 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: lerdsuwa@gcc.gnu.org 2005-02-12 16:29:21 Modified files: gcc/cp : ChangeLog cp-tree.h name-lookup.c pt.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: enum5.C Log message: PR c++/14479 PR c++/19487 * pt.c (maybe_check_template_type): Remove. * cp-tree.h (maybe_check_template_type): Remove prototype. * name-lookup.c (maybe_process_template_type_declaration): Don't use maybe_check_template_type. * g++.dg/template/enum5.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.198&r2=1.3892.2.199 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.946.4.17&r2=1.946.4.18 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.34.2.20&r2=1.34.2.21 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.816.2.50&r2=1.816.2.51 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.361&r2=1.3389.2.362 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/enum5.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
Fixed in 3.4/4.0.
Probably won't fixed in 3.3.
won't fix for 3.3.6. Fixed in 3.4.x
Fixed so closing as such.