User account creation filtered due to spam.

Bug 22545 - [3.4 Regression] ICE with pointer to class member & user defined conversion operator
Summary: [3.4 Regression] ICE with pointer to class member & user defined conversion o...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: 3.4.5
Assignee: Volker Reichelt
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: ice-checking, ice-on-valid-code, monitored, patch
Depends on:
Blocks:
 
Reported: 2005-07-18 12:17 UTC by Paul Woegerer
Modified: 2005-09-01 11:50 UTC (History)
2 users (show)

See Also:
Host:
Target: i686-pc-linux-gnu
Build:
Known to work:
Known to fail: 4.1.0 4.0.0
Last reconfirmed: 2005-07-18 14:10:41


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Woegerer 2005-07-18 12:17:39 UTC
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;
}
Comment 1 Andrew Pinski 2005-07-18 14:10:41 UTC
Confirmed, 3.4 ICEs when checking is turned on too.  Likewise for 4.0.0.
Comment 2 Andrew Pinski 2005-07-22 21:13:26 UTC
Moving to 4.0.2 pre Mark.
Comment 3 Volker Reichelt 2005-07-25 11:47:21 UTC
Smaller testcase:

======================
struct A
{
    operator A*();
};

void foo(int A::* p)
{
    A() ->* p;
}
======================
Comment 4 CVS Commits 2005-07-28 18:09:12 UTC
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

Comment 5 CVS Commits 2005-07-28 19:02:50 UTC
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

Comment 6 Mark Mitchell 2005-07-28 19:16:05 UTC
Fixed in 4.0.2.
Comment 7 Volker Reichelt 2005-09-01 09:15:30 UTC
Taking care of the backport to the 3.4 branch.
Comment 8 CVS Commits 2005-09-01 11:47:54 UTC
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

Comment 9 Volker Reichelt 2005-09-01 11:50:49 UTC
Fixed also on the 3.4 branch.