Bug 15701 - [3.4/4.0 regression] ICE with friends and template template parameter
Summary: [3.4/4.0 regression] ICE with friends and template template parameter
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.0
: P2 critical
Target Milestone: 3.4.1
Assignee: Mark Mitchell
URL:
Keywords: ice-on-valid-code, monitored
Depends on:
Blocks:
 
Reported: 2004-05-28 07:17 UTC by Ivan Godard
Modified: 2004-10-30 21:11 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 3.3.3
Known to fail: 3.4.0 4.0.0
Last reconfirmed: 2004-05-28 12:08:13


Attachments
Compiler output (-v -save-temps) (728 bytes, text/plain)
2004-05-28 07:18 UTC, Ivan Godard
Details
Source code (-save-temps) (103.90 KB, text/plain)
2004-05-28 07:19 UTC, Ivan Godard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Godard 2004-05-28 07:17:51 UTC
 
Comment 1 Ivan Godard 2004-05-28 07:18:27 UTC
Created attachment 6411 [details]
Compiler output (-v -save-temps)
Comment 2 Ivan Godard 2004-05-28 07:19:36 UTC
Created attachment 6412 [details]
Source code (-save-temps)
Comment 3 Volker Reichelt 2004-05-28 12:08:12 UTC
Confirmed.

Here's a reduced testcase that segfaults since gcc 3.4.0:

===============================================================
template<template<int> class T> struct A : T<0>
{
    void foo();
    template<template<int> class U> friend void A<U>::foo();
};

template<int> struct B {};

A<B> a;
===============================================================

The problem seems to be related to the template template parameter.
If I make T, U, B regular classes, the code compiles.
Comment 4 Mark Mitchell 2004-05-31 21:56:42 UTC
Working on a fix.
Comment 5 CVS Commits 2004-05-31 22:47:22 UTC
Subject: Bug 15701

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	mmitchel@gcc.gnu.org	2004-05-31 22:47:16

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

Log message:
	PR c++/15701
	* friend.c (add_friend): Do not try to perform access checks for
	functions from dependent classes.
	
	PR c++/15701
	* g++.dg/template/friend29.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.190&r2=1.3389.2.191
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.110&r2=1.3892.2.111
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/friend.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.93.4.1&r2=1.93.4.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/friend29.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1

Comment 6 CVS Commits 2004-05-31 22:48:00 UTC
Subject: Bug 15701

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-05-31 22:47:57

Modified files:
	gcc/cp         : friend.c 
Added files:
	gcc/testsuite/g++.dg/template: friend29.C 

Log message:
	PR c++/15701
	* friend.c (add_friend): Do not try to perform access checks for
	functions from dependent classes.
	
	PR c++/15701
	* g++.dg/template/friend29.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/friend.c.diff?cvsroot=gcc&r1=1.96&r2=1.97
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/friend29.C.diff?cvsroot=gcc&r1=1.1&r2=1.2

Comment 7 CVS Commits 2004-05-31 22:48:32 UTC
Subject: Bug 15701

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-05-31 22:48:30

Modified files:
	gcc/cp         : ChangeLog 
	gcc/testsuite  : ChangeLog 

Log message:
	PR c++/15701
	* friend.c (add_friend): Do not try to perform access checks for
	functions from dependent classes.
	
	PR c++/15701
	* g++.dg/template/friend29.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4071&r2=1.4072
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3799&r2=1.3800

Comment 8 Mark Mitchell 2004-05-31 22:57:08 UTC
Fixed in GCC 3.4.1.