Compiling the example below with g++ from snapshot 4.1.0 20050716 causes the following error message: > g++ -S cpp_parse_internal_error.cpp cpp_parse_internal_error.cpp: In function 'int main()': cpp_parse_internal_error.cpp:23: internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in is_complete, at cp/call.c:1567 Compiling the same example with 3.4.4 works perfectly and correctly returns 13 as result. The behaviour does not depend on the optimization level (O0, O3 all the same) ------------------------------------------- cpp_parse_internal_error.cpp struct A { int member; A() : member(13) {} }; A a; struct B { operator A*() { return &a; } }; B b; int A::* member_pntr = &A::member; int main() { // That one WORKS // A *a_pntr = b; // return a_pntr ->* member_pntr; // But this one causes an INTERNAL ERROR return b ->* member_pntr; }
Confirmed, 3.4 ICEs when checking is turned on too. Likewise for 4.0.0.
Moving to 4.0.2 pre Mark.
Smaller testcase: ====================== struct A { operator A*(); }; void foo(int A::* p) { A() ->* p; } ======================
Subject: Bug 22545 CVSROOT: /cvs/gcc Module name: gcc Changes by: mmitchel@gcc.gnu.org 2005-07-28 18:09:00 Modified files: gcc/cp : ChangeLog call.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/expr: ptrmem7.C Log message: PR c++/22545 * call.c (add_builtin_candidate): Adjust for changes in representation of pointer-to-member types. PR c++/22545 * g++.dg/expr/ptrmem7.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4836&r2=1.4837 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&r1=1.548&r2=1.549 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5844&r2=1.5845 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/expr/ptrmem7.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 22545 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: mmitchel@gcc.gnu.org 2005-07-28 19:02:28 Modified files: gcc/cp : ChangeLog call.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/expr: ptrmem7.C Log message: PR c++/22545 * call.c (add_builtin_candidate): Adjust for changes in representation of pointer-to-member types. PR c++/22545 * g++.dg/expr/ptrmem7.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.70&r2=1.4648.2.71 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.531.2.5&r2=1.531.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.307&r2=1.5084.2.308 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/expr/ptrmem7.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
Fixed in 4.0.2.
Taking care of the backport to the 3.4 branch.
Subject: Bug 22545 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: reichelt@gcc.gnu.org 2005-09-01 11:47:42 Modified files: gcc/cp : ChangeLog decl2.c call.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: error17.C gcc/testsuite/g++.dg/expr: ptrmem7.C Log message: Backport: 2005-02-22 Mark Mitchell <mark@codesourcery.com> PR c++/20153 * decl2.c (build_anon_union_vars): Add type parameter. (finish_anon_union): Pass it. * g++.dg/template/error17.C: New test. 2005-07-28 Mark Mitchell <mark@codesourcery.com> PR c++/22545 * call.c (add_builtin_candidate): Adjust for changes in representation of pointer-to-member types. * g++.dg/expr/ptrmem7.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.232&r2=1.3892.2.233 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl2.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.695.4.10&r2=1.695.4.11 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.452.2.27&r2=1.452.2.28 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.423&r2=1.3389.2.424 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/error17.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.40.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/expr/ptrmem7.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.12.1
Fixed also on the 3.4 branch.