Bug 21592 - [3.4/4.0/4.1 Regression] ICE in resolve_overloaded_unification/arg_assoc
Summary: [3.4/4.0/4.1 Regression] ICE in resolve_overloaded_unification/arg_assoc
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 4.0.3
Assignee: Nathan Sidwell
URL:
Keywords: ice-on-invalid-code, monitored
: 20549 22124 22611 24171 (view as bug list)
Depends on:
Blocks: 24171
  Show dependency treegraph
 
Reported: 2005-05-15 20:17 UTC by Ivan Godard
Modified: 2005-10-13 13:12 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work: 3.3.3
Known to fail: 3.4.0 4.0.0 4.1.0
Last reconfirmed: 2005-10-12 14:30:34


Attachments
compiler output (785 bytes, application/octet-stream)
2005-05-15 20:18 UTC, Ivan Godard
Details
source code (compressed) (180.14 KB, application/x-gzip)
2005-05-15 20:18 UTC, Ivan Godard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Godard 2005-05-15 20:17:41 UTC
 
Comment 1 Ivan Godard 2005-05-15 20:18:11 UTC
Created attachment 8893 [details]
compiler output
Comment 2 Ivan Godard 2005-05-15 20:18:33 UTC
Created attachment 8894 [details]
source code (compressed)
Comment 3 Andrew Pinski 2005-05-15 20:57:07 UTC
Confirmed, reduced testcase:
class cl
{
  int str();
  void str(const int& __s);
};

template <typename T>
int &f(const T& t);

template<int s>
void g()
{
  cl str;
  f(str.str);
}


-------

I don't know if this is valid code or not, 3.3.3 accepted it and so does ICC even in strict mode.
Comment 4 Andrew Pinski 2005-05-15 21:02:46 UTC
Note the ICE moved from arg_assoc to resolve_overloaded_unification in 4.0.0.
Comment 5 Giovanni Bajo 2005-05-16 01:43:06 UTC
Definitely invalid code, you can't do anything with a bound pointer in C++. 
Comeau strict mode reports the error:

"ComeauTest.c", line 14: error: a pointer to a bound function may only be used 
to
          call the function
        Wild Guess: You're calling a member function and forgot the ()'s
    f(str.str);
          ^
Comment 6 Thomas Koenig 2005-06-22 11:42:55 UTC
*** Bug 22124 has been marked as a duplicate of this bug. ***
Comment 7 Andrew Pinski 2005-07-22 17:59:32 UTC
*** Bug 22611 has been marked as a duplicate of this bug. ***
Comment 8 Andrew Pinski 2005-07-22 21:13:14 UTC
Moving to 4.0.2 pre Mark.
Comment 9 Volker Reichelt 2005-07-25 13:22:51 UTC
*** Bug 20549 has been marked as a duplicate of this bug. ***
Comment 10 Volker Reichelt 2005-07-25 13:26:46 UTC
Just for completeness, a slightly reduced version of the testcase from
PR 20549:

=======================================
template<typename T> void unique(T,T);

struct A
{
  int begin();
};

template<int> void foo()
{
  unique(A().begin);
}
=======================================
Comment 11 Andrew Pinski 2005-10-03 14:28:33 UTC
*** Bug 24171 has been marked as a duplicate of this bug. ***
Comment 12 CVS Commits 2005-10-12 18:13:44 UTC
Subject: Bug 21592

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	nathan@gcc.gnu.org	2005-10-12 18:13:41

Modified files:
	gcc/cp         : ChangeLog pt.c typeck.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/g++.dg/template: dependent-expr1.C 
	                               dependent-expr2.C 
Added files:
	gcc/testsuite/g++.dg/template: overload6.C 

Log message:
	cp:
	PR c++/21592
	* pt.c (build_non_dependent_expr): Don't wrap a COMPONENT_REF
	with already looked up member functions.  Assert we're not
	returning a NON_DEPENDENT_EXPR with unknown type.
	* typeck.c (finish_class_member_access_expr):  We can get
	non-template-id-expr baselinks.  If the lookup finds a baselink,
	remember it even inside templates.
	testsuite:
	PR c++/21592
	* g++.dg/template/dependent-expr1.C: Add new expected error.
	* g++.dg/template/dependent-expr2.C: Adjust error text.
	* g++.dg/template/overload6.C: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4926&r2=1.4927
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.1044&r2=1.1045
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&r1=1.655&r2=1.656
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.6178&r2=1.6179
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/overload6.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/dependent-expr1.C.diff?cvsroot=gcc&r1=1.2&r2=1.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/dependent-expr2.C.diff?cvsroot=gcc&r1=1.1&r2=1.2

Comment 13 Nathan Sidwell 2005-10-12 18:23:20 UTC
Fixed mainline & 4.0
2005-10-12  Nathan Sidwell  <nathan@codesourcery.com>

	PR c++/21592
	* pt.c (build_non_dependent_expr): Don't wrap a COMPONENT_REF
	with already looked up member functions.  Assert we're not
	returning a NON_DEPENDENT_EXPR with unknown type.
	* typeck.c (finish_class_member_access_expr):  We can get
	non-template-id-expr baselinks.  If the lookup finds a baselink,
	remember it even inside templates.
Comment 14 CVS Commits 2005-10-12 18:23:24 UTC
Subject: Bug 21592

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	nathan@gcc.gnu.org	2005-10-12 18:23:17

Modified files:
	gcc/testsuite  : ChangeLog 
	gcc/cp         : ChangeLog pt.c typeck.c parser.c decl.c 
Added files:
	gcc/testsuite/g++.dg/other: return1.C 
	gcc/testsuite/g++.dg/parse: typename8.C 
	gcc/testsuite/g++.dg/template: overload6.C 

Log message:
	cp:
	PR c++/21592
	* pt.c (build_non_dependent_expr): Don't wrap a COMPONENT_REF
	with already looked up member functions.  Assert we're not
	returning a NON_DEPENDENT_EXPR with unknown type.
	* typeck.c (finish_class_member_access_expr):  We can get
	non-template-id-expr baselinks.  If the lookup finds a baselink,
	remember it even inside templates.
	
	PR c++/23797
	* parser.c (cp_parser_functional_cast): Cope when TYPE is not a
	TYPE_DECL.  Use dependent_type_p to check type.
	* pt.c (uses_template_parms_p): Use dependent_type_p for a
	TYPE_DECL.
	(type_dependent_expression_p): Assert we've not been given a
	TYPE_DECL.
	
	PR c++/21117
	* decl.c (check_function_type): Correctly overwrite incomplete
	return type with void type.
	* typeck.c (check_return_expr): If the function's return type is
	void, don't try and convert a return expr.
	testsuite:
	PR c++/21592
	* g++.dg/template/dependent-expr1.C: Add new expected error.
	* g++.dg/template/dependent-expr2.C: Adjust error text.
	* g++.dg/template/overload6.C: New.
	
	PR c++/23797
	* g++.dg/other/typename8.C: New.
	
	PR c++/21117
	* g++.dg/other/return1.C: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/other/return1.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/typename8.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/overload6.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
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.450&r2=1.5084.2.451
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.127&r2=1.4648.2.128
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.978.2.30&r2=1.978.2.31
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.616.2.20&r2=1.616.2.21
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.319.2.22&r2=1.319.2.23
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1371.2.24&r2=1.1371.2.25

Comment 15 Nathan Sidwell 2005-10-13 13:12:44 UTC
wont fix for pre 4.0