Bug 9810

Summary: Using-declaration for template functions does not work
Product: gcc Reporter: comer
Component: c++Assignee: Kriang Lerdsuwanakij <lerdsuwa>
Status: RESOLVED FIXED    
Severity: normal CC: gcc-bugs, lerdsuwa, pallas, pinskia, reichelt
Priority: P3 Keywords: monitored, rejects-valid
Version: 3.2   
Target Milestone: 3.4.0   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2003-10-14 19:14:10
Attachments: tst51.cpp

Description comer 2003-02-22 20:46:00 UTC
struct A
{
	template<class R>
	void F(R)
	{ // line # 5
	}
};

struct B: private A
{
	using A::F; // line # 11
};

int main()
{
	B b;
	b.F(3); // line # 17
	return 0;
}

Release:
3.2 20020818 (prerelease)

Environment:
Windows, Cygwin

How-To-Repeat:
g++ tst51.cpp
Comment 1 comer 2003-02-22 20:46:00 UTC
Fix:
struct A
{
	template<class R>
	void F(R)
	{ 
	}
};

struct B: private A
{
	//using A::F; 
	template<class R>
	void F(R r)
	{
		A::F(r);
	}	
};

int main()
{
	B b;
	b.F(3);
	return 0;
}
Comment 2 Wolfgang Bangerth 2003-02-24 15:07:39 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: COnfirmed for all versions of gcc from 2.95 to present
    mainline.
Comment 3 Drea Pinski 2003-06-07 15:55:35 UTC
still happens on the mainline (20030607).
Comment 4 Wolfgang Bangerth 2003-08-20 14:18:14 UTC
This is actually an access checking problem. Krian, you are the expert resident for 
this, so I add you to the CCs. 
 
W. 
Comment 5 Kriang Lerdsuwanakij 2003-08-23 15:41:15 UTC
Will investigate.
Comment 6 Kriang Lerdsuwanakij 2003-10-25 15:12:24 UTC
Patch in progress.
Comment 7 GCC Commits 2003-11-02 14:17:42 UTC
Subject: Bug 9810

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	lerdsuwa@gcc.gnu.org	2003-11-02 14:17:39

Modified files:
	gcc/cp         : ChangeLog call.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/g++.old-deja/g++.other: access11.C 
Added files:
	gcc/testsuite/g++.dg/template: using8.C 

Log message:
	PR c++/9810
	* call.c (build_over_call): Check access using primary template
	if FN is a member function template.
	
	* g++.dg/template/using8.C: New test.
	* g++.old-deja/g++.other/access11.C: Adjust expected error location.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3747&r2=1.3748
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&r1=1.440&r2=1.441
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3165&r2=1.3166
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/using8.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.other/access11.C.diff?cvsroot=gcc&r1=1.2&r2=1.3

Comment 8 Kriang Lerdsuwanakij 2003-11-02 14:19:18 UTC
Fixed in the mainline.