This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14507] New: [3.1/3.2/3.2.2/3.2.3/3.3.2/3.3.3 Regression From 2.95.2/2.95.3] Wacky Template ICE
- From: "stl at caltech dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Mar 2004 19:25:04 -0000
- Subject: [Bug c++/14507] New: [3.1/3.2/3.2.2/3.2.3/3.3.2/3.3.3 Regression From 2.95.2/2.95.3] Wacky Template ICE
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
This bug was found by John Saalweachter, saalweaj@purdue.edu ; I reduced the
test case and agreed to submit a PR. I have no clue whether the test case is
valid or not.
The following test case ICEs when compiled with g++ -c:
template <typename A, typename B = int, typename C = int, typename D = int>
struct c : virtual c<A, B> { };
template <typename A, typename B, typename C>
struct c<A, B, C, int> : c<A, B> {
c() : c() { }
};
I observe the ICE with:
i686-pc-linux-gnu 3.3.2
sparc-sun-solaris2.7 3.2.3
i686-pc-linux-gnu 3.2.2
i386-redhat-linux 3.2.2
i686-pc-linux-gnu 3.1
i686-pc-linux-gnu 3.2
John Saalweachter observes the ICE with:
i686-pc-linux-gnu 3.3.3
i386-slackware-linux 3.2
i486-slackware-linux 3.2.3
All of these ICEs occur with no other output. For example, my i686-pc-linux-
gnu 3.3.2 emits:
g++: Internal error: Segmentation fault (program cc1plus)
Please submit a full bug report.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
I observe a clean compile (no ICE, no complaining) with:
i686-pc-linux-gnu 2.95.3
John Saalweachter also observes a clean compile with:
sparc-sun-solaris2.8 2.95.2
Here are three less reduced test cases that also ICE (on my i686-pc-linux-gnu
3.3.2; I don't know about other systems for these test cases):
[FIRST]
struct s { };
s foo;
template <typename T, s &i0 = foo, s &i1 = foo, s &i2 = foo>
class c : virtual public c<T, i0> { };
template <typename T, s &i0, s &i1>
class c<T, i0, i1, foo> : public c<T, i0> {
public:
c (const T &i) : c<T> (i) { }
};
[SECOND]
struct s { };
template <typename T, typename i0 = s, typename i1 = s, typename i2 = s>
class c : virtual public c<T, i0> { };
template <typename T, typename i0, typename i1>
class c<T, i0, i1, s> : public c<T, i0> {
public:
c (const T &i) : c<T> (i) { }
};
[THIRD]
struct s { };
template <typename A, typename B = s, typename C = s, typename D = s>
struct c : virtual c<A, B> { };
template <typename A, typename B, typename C>
struct c<A, B, C, s> : c<A, B> {
c(const A &i) : c<A> (i) { }
};
--
Summary: [3.1/3.2/3.2.2/3.2.3/3.3.2/3.3.3 Regression From
2.95.2/2.95.3] Wacky Template ICE
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: stl at caltech dot edu
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14507