Compiling the following testcase GCC ICEs with the error bellow. The test case is derived from one configure test of libsigc++2.x. struct Thing { template <class T> void operator()(T a, T b) { } }; template<class T2> struct OtherThing { void do_something() { Thing thing_; thing_.template operator()<T2>(1, 2); } }; wilx@logout:::~/tmp> g++ -c libsigc++-test.cxx libsigc++-test.cxx: In member function `void OtherThing<T2>::do_something()': libsigc++-test.cxx:14: internal compiler error: tree check: expected class 'd', have 'x' (identifier_node) in dependent_template_p, at cp/pt.c:12043 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Confirmed. Here's a reduced code snippet: ============================================= struct A { template<int> void operator()() {} }; template<typename> void foo() { A().template operator()<0>(); } =============================================
Well done, Volker: this intriguing anagramatic sequence in your testcase ()<0>() clearly asks for an award for "art in testcases" :-) W.
: Search converges between 2003-07-08-trunk (#288) and 2003-07-09-trunk (#289). I almost think it was caused by: 2003-07-08 Mark Mitchell <mark@codesourcery.com> * cp-tree.def (NON_DEPENDENT_EXPR): New node. * cp-tree.h (build_call_from_tree): Remove. (build_member_call): Likewise. ...., etc.
> ------- Additional Comments From bangerth at dealii dot org 2004-08-17 20:15 ------- > Well done, Volker: this intriguing anagramatic sequence in your testcase > ()<0>() > clearly asks for an award for "art in testcases" :-) Well, I couldn't help it - I had to find a really symmetric testcase. :-) And here it is (it's a modified version from PR 16971). You can read it forwards and backwards (well, you have to revert the braces): ============================================= namespace { ; int tni ; int tni ; } ecapseman ============================================= The error message mainline used to give was: :1:C.C:1: error: redefinition of `int <unnamed>::tni' :1:C.C:1: error: `int <unnamed>::tni' previously declared here :1:C.C:1: internal compiler error: tree check: expected class 'd', have 'x' (error_mark) in cp_parser_init_declarator, at cp/parser.c:10717 Please submit a full bug report, [etc.]
Extremely cool. Also the choice of filename is very innovative. I'm almost thinking we should have a metabug for cases like this. In the spirit of PR 5 :-)
Working on a fix.
Subject: Bug 17068 CVSROOT: /cvs/gcc Module name: gcc Changes by: mmitchel@gcc.gnu.org 2004-08-18 18:25:10 Modified files: gcc/cp : ChangeLog pt.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: operator4.C Log message: PR c++/17068 * pt.c (dependent_template_p): Treat IDENTIFIER_NODEs as dependent. PR c++/17068 * g++.dg/template/operator4.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4281&r2=1.4282 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.907&r2=1.908 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4155&r2=1.4156 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/operator4.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 17068 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: mmitchel@gcc.gnu.org 2004-08-18 18:34:26 Modified files: gcc/cp : ChangeLog pt.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: operator4.C Log message: PR c++/17068 * pt.c (dependent_template_p): Treat IDENTIFIER_NODEs as dependent. PR c++/17068 * g++.dg/template/operator4.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.147&r2=1.3892.2.148 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.39&r2=1.816.2.40 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.250&r2=1.3389.2.251 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/operator4.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
Fixed in GCC 3.4.2.