Bug 10199 - [3.3 regression] method parametrized by template does not work everywhere
Summary: [3.3 regression] method parametrized by template does not work everywhere
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.3
: P3 normal
Target Milestone: ---
Assignee: Nathan Sidwell
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2003-03-24 06:36 UTC by 185604
Modified: 2003-07-25 17:33 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description 185604 2003-03-24 06:36:00 UTC
[ Reported to the Debian BTS as report #185604.
  Please CC 185604@bugs.debian.org on replies.
  Log of report can be found at http://bugs.debian.org/185604 ]
	

- 3.2 CVS 20030316 rejects the code
- 3.3 CVS 20030323 ICEs in the error message (the regression)
- 3.4 CVS 20030316 compiles the code

 $ g++-3.2 bugs-185604.cc
bugs-185604.cc: In function `void bar(T&) [with T = int]':
bugs-185604.cc:26:   instantiated from here
bugs-185604.cc:18: no matching function for call to `X::bar()'

$ g++-3.3 bugs-185604.cc
bugs-185604.cc: In function `void bar(T&)':
bugs-185604.cc:18: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.


The following program is valid C++, but does not compile:

-- snip --

class X {
public:
  template<int d>
  int bar () {return d;}
};

template<int x>
int fooo ()
{
  return x;
}

template<class T>
void bar (T& g)
{
  int kk = fooo<17>();  // OK
  X x;
  int k = x.bar<17>();  // Not OK
}

int main ()
{
  X x;
  int k=x.bar<17>();    // OK
  int n;
  bar(n);
}

-- snip --

Release:
3.3 CVS 20030323

Unformatted:
 System: Debian GNU/Linux (unstable)
 Architecture: i686
Comment 1 Steven Bosscher 2003-03-24 10:15:36 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed
Comment 2 Nathan Sidwell 2003-03-24 13:41:03 UTC
Responsible-Changed-From-To: unassigned->nathan
Responsible-Changed-Why: fixing
Comment 3 Nathan Sidwell 2003-03-24 18:21:46 UTC
From: nathan@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/10199
Date: 24 Mar 2003 18:21:46 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_3-branch
 Changes by:	nathan@gcc.gnu.org	2003-03-24 18:21:46
 
 Modified files:
 	gcc/cp         : ChangeLog call.c semantics.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/lookup: template1.C 
 
 Log message:
 	cp:
 	PR c++/10199
 	* call.c (build_method_call): Deal with LOOKUP_EXPR.
 	* semantics.c (finish_object_call_expr): Use build_method_call
 	when in a template decl.
 	testsuite
 	PR c++/10199
 	* g++.dg/lookup/template1.C: New test.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.94&r2=1.3076.2.95
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.341.2.15&r2=1.341.2.16
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.282.4.2&r2=1.282.4.3
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.113&r2=1.2261.2.114
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/template1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.14.1
 

Comment 4 Nathan Sidwell 2003-03-24 18:21:46 UTC
From: nathan@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/10199
Date: 24 Mar 2003 18:21:46 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_3-branch
 Changes by:	nathan@gcc.gnu.org	2003-03-24 18:21:46
 
 Modified files:
 	gcc/cp         : ChangeLog call.c semantics.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/lookup: template1.C 
 
 Log message:
 	cp:
 	PR c++/10199
 	* call.c (build_method_call): Deal with LOOKUP_EXPR.
 	* semantics.c (finish_object_call_expr): Use build_method_call
 	when in a template decl.
 	testsuite
 	PR c++/10199
 	* g++.dg/lookup/template1.C: New test.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.94&r2=1.3076.2.95
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.341.2.15&r2=1.341.2.16
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.282.4.2&r2=1.282.4.3
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.113&r2=1.2261.2.114
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/template1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.14.1
 
Comment 5 Nathan Sidwell 2003-03-24 18:39:37 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: 2003-03-24  Nathan Sidwell  <nathan@codesourcery.com>
    
    	PR c++/10199
    	* call.c (build_method_call): Deal with LOOKUP_EXPR.
    	* semantics.c (finish_object_call_expr): Use build_method_call
    	when in a template decl.