Bug 11347 - [3.4 regression] Error on valid expression in default value for int argument to inner template.
Summary: [3.4 regression] Error on valid expression in default value for int argument ...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.3
: P1 normal
Target Milestone: 3.4.0
Assignee: Nathan Sidwell
URL:
Keywords: monitored, rejects-valid
Depends on:
Blocks:
 
Reported: 2003-06-27 11:25 UTC by Joerg Baumann
Modified: 2004-01-17 04:22 UTC (History)
2 users (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-07-01 15:44:34


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joerg Baumann 2003-06-27 11:25:10 UTC
The data here is from gcc 3.3, but 2.95.3, 3.2.2, 3.4CVS also generate ICE.

bash-2.05$ g++3.3 -v -save-temps -c ice.C
Reading specs from /usr/local/gcc-3.3/lib/gcc-lib/i686-pc-linux-gnu/3.3/specs
Configured with: ../gcc-3.3/configure --prefix=/usr/local/gcc-3.3
--enable-threads --enable-version-specific-runtime-libs
Thread model: posix
gcc version 3.3
 /usr/local/gcc-3.3/lib/gcc-lib/i686-pc-linux-gnu/3.3/cc1plus -E -D__GNUG__=3
-quiet -v -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=0 -D_GNU_SOURCE
ice.C ice.ii
ignoring nonexistent directory "/usr/local/gcc-3.3/i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/gcc-3.3/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/c++
 /usr/local/gcc-3.3/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/c++/i686-pc-linux-gnu
 /usr/local/gcc-3.3/lib/gcc-lib/i686-pc-linux-gnu/3.3/include/c++/backward
 /usr/local/include
 /usr/local/gcc-3.3/include
 /usr/local/gcc-3.3/lib/gcc-lib/i686-pc-linux-gnu/3.3/include
 /usr/include
End of search list.
 /usr/local/gcc-3.3/lib/gcc-lib/i686-pc-linux-gnu/3.3/cc1plus -fpreprocessed
ice.ii -quiet -dumpbase ice.C -auxbase ice -version -o ice.s
GNU C++ version 3.3 (i686-pc-linux-gnu)
        compiled by GNU C version 3.3.
GGC heuristics: --param ggc-min-expand=55 --param ggc-min-heapsize=48266
ice.C: In instantiation of `T2<int>':
ice.C:9:   instantiated from here
ice.C:6: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.


# 1 "ice.C"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "ice.C"
template <class T> struct T1 {
  enum {N};
};

template<class T> struct T2 {
  template <class S, bool Z = T1<S>::N + 1> struct B {};
};

T2<int> t;
Comment 1 Andrew Pinski 2003-06-27 11:43:37 UTC
I can confirm this on 2.91.66, 2.95.3, 3.0.4, 3.2.2, 3.2.3, 3.3.1 (20030616) and the mainline 
(20030626). Looks like this has been a problem for a very long time.
Comment 2 Giovanni Bajo 2003-06-27 11:54:39 UTC
It's the same problem of c++/6730, see http://gcc.gnu.org/bugzilla/show_bug.cgi?
id=6730#c3. I'll keep both open because they both give different but 
interesting testcases, and then I might be wrong :)
Comment 3 Volker Reichelt 2003-07-15 08:29:53 UTC
Fixed on mainline.
(Testcase in preparation.)

BTW, it's not the same problem as in PR 6730, since this PR is still not fixed.
Comment 4 Volker Reichelt 2003-07-28 08:13:01 UTC
We now have an rejects-legal bug on mainline :-(

The error message is:

dPR11347.cc: In instantiation of `B<int>':
dPR11347.cc:16:   instantiated from here
dPR11347.cc:13: error: `e' is not a member of `A<T>'

Nathan, could you please have a look? Given the error message it seems
as if your patch for PR11617 is responsible for the regression.
Comment 5 Nathan Sidwell 2003-07-31 09:10:14 UTC
2003-07-31  Nathan Sidwell  <nathan@codesourcery.com>

	PR c++/11347
	* pt.c (instantiate_class_template): Increment
	processing_template_decl around the tsubst of a template member
	class.
	(tsubst_qualified_id): Assert we do not have a dependent scope.
Comment 6 GCC Commits 2003-07-31 09:11:04 UTC
Subject: Bug 11347

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	nathan@gcc.gnu.org	2003-07-31 09:10:58

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

Log message:
	cp:
	PR c++/11347
	* pt.c (instantiate_class_template): Increment
	processing_template_decl around the tsubst of a template member
	class.
	(tsubst_qualified_id): Assert we do not have a dependent scope.
	testsuite:
	PR c++/11347
	* g++.dg/template/memtmpl1.C: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3571&r2=1.3572
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.743&r2=1.744
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2933&r2=1.2934
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/memtmpl1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1