Bug 13310 - Tree check error in dependent_template_p
Summary: Tree check error in dependent_template_p
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 3.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-invalid-code, monitored
Depends on:
Blocks: c++-lookup, c++-name-lookup
  Show dependency treegraph
 
Reported: 2003-12-05 01:13 UTC by Wolfgang Bangerth
Modified: 2003-12-15 21:56 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2003-12-05 01:33:10


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wolfgang Bangerth 2003-12-05 01:13:09 UTC
Playing around with 13306, I find this:  
------------------------  
template <typename> struct A {  
        template <typename> void g() {}  
};  
  
template <typename> void f() {  
  A<int> a;  
  a.f<double>();  
}  
-------------------------  
The code is invalid, because there is no A::f, but instead of an error  
we get on present mainline 
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc  
x.cc: In function `void f()':  
x.cc:7: internal compiler error: tree check: expected class 'd', have  
'x' (overload) in dependent_template_p, at cp/pt.c:11926  
  
I don't think that's much of a regression since pre-3.4 we silently accepted 
this in the absence of two-stage name lookup. It would be nice to have it 
fixed for 3.4 anyway, though. 
 
W.
Comment 1 Andrew Pinski 2003-12-05 01:33:10 UTC
This ICE without checking:
pr13310.cc: In function `void f()':
pr13310.cc:7: internal compiler error: in lookup_member, at cp/search.c:1228
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 2 Volker Reichelt 2003-12-08 02:17:26 UTC
Here's an even simpler testcase:

===============================
struct A {};

template <typename> void foo()
{
    A a;
    a.foo<int>();
}
===============================
Comment 3 GCC Commits 2003-12-15 21:55:25 UTC
Subject: Bug 13310

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2003-12-15 21:55:20

Modified files:
	gcc/cp         : ChangeLog pt.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/template: crash15.C 

Log message:
	PR c++/13310
	* pt.c (dependent_template_p): Handle OVERLOADs.
	
	PR c++/13310
	* g++.dg/template/crash15.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3803&r2=1.3804
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.802&r2=1.803
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3257&r2=1.3258
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/crash15.C.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 4 Mark Mitchell 2003-12-15 21:56:16 UTC
Fixed in GCC 3.4.