Bug 12266 - [3.3/3.4 regression] incorrect instantiation of unneeded template during overload resolution
Summary: [3.3/3.4 regression] incorrect instantiation of unneeded template during over...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 3.3.2
Assignee: Mark Mitchell
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-12 18:16 UTC by Nathan Sidwell
Modified: 2004-01-17 04:22 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2003-09-12 18:38:07


Attachments
testcase (116 bytes, text/plain)
2003-09-12 18:17 UTC, Nathan Sidwell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan Sidwell 2003-09-12 18:16:28 UTC
Overload resolution causes instantiation of 'T Foo<void> (int)', when
trying 'void Baz (void (*)(int), int)'. that is not selected
by overload resolution, but we go ahead an instantiate the body of
Foo anyway (which fails).
Comment 1 Nathan Sidwell 2003-09-12 18:17:48 UTC
Created attachment 4745 [details]
testcase
Comment 2 Nathan Sidwell 2003-09-12 18:19:22 UTC
I believe we're calling mark_used too early during overload resolution.
Comment 3 Wolfgang Bangerth 2003-09-12 18:38:07 UTC
Confirmed. This is a regression introduced between 2.95 and 3.0.

W.
Comment 4 GCC Commits 2003-09-17 23:43:01 UTC
Subject: Bug 12266

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2003-09-17 23:42:56

Modified files:
	gcc/cp         : ChangeLog call.c class.c cp-tree.h 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/overload: template1.C 

Log message:
	PR c++/12266
	* cp-tree.h (tsubst_flags_t): Add tf_conv.
	* class.c (standard_conversion): Pass tf_conv to
	instantiate_type.
	(resolve_address_of_overloaded_function): Do not call mark_used
	when just checking conversions.
	
	PR c++/12266
	* g++.dg/overload/template1.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3684&r2=1.3685
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&r1=1.433&r2=1.434
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&r1=1.572&r2=1.573
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.917&r2=1.918
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3060&r2=1.3061
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/overload/template1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 5 Mark Mitchell 2003-09-17 23:51:35 UTC
Fixed in GCC 3.3.2, GCC 3.4.