public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/9338: ICE in peculiar templated constructors
@ 2003-04-07 10:56 Giovanni Bajo
0 siblings, 0 replies; 3+ messages in thread
From: Giovanni Bajo @ 2003-04-07 10:56 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/9338; it has been noted by GNATS.
From: "Giovanni Bajo" <giovannibajo@libero.it>
To: <gcc-gnats@gcc.gnu.org>,
<gcc-bugs@gcc.gnu.org>,
<martin@xemacs.org>,
<nobody@gcc.gnu.org>,
<gcc-prs@gcc.gnu.org>
Cc: "Wolfgang Bangerth" <bangerth@ices.utexas.edu>
Subject: Re: c++/9338: ICE in peculiar templated constructors
Date: Mon, 7 Apr 2003 12:50:17 +0200
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p
r=9338
Reconfirmed today on 2.95 -> 3.3 (bump [date] please).
Giovanni Bajo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: c++/9338: ICE in peculiar templated constructors
@ 2003-01-16 15:12 bangerth
0 siblings, 0 replies; 3+ messages in thread
From: bangerth @ 2003-01-16 15:12 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, martin, nobody
Synopsis: ICE in peculiar templated constructors
State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Thu Jan 16 07:12:02 2003
State-Changed-Why:
Confirmed. A smaller testcase is this:
-------------------------
struct Bool {
template <bool> struct CC { typedef int Int; };
template <typename> struct S1 { enum { value = true }; };
template <typename> struct S2 { enum { value = false }; };
template <typename T>
Bool (T x, typename CC<S1<T>::value>::Int = 0);
template <typename T>
Bool (T x, typename CC<!S2<T>::value>::Int = 0);
};
int main () {
Bool b (1);
}
--------------------------------------
Note that the second type of the two overloads of the
constructor resolve to the same type, int.
This code crashes gcc since at least 2.95:
g/a> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
x.cc: In function `int main()':
x.cc:15: 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.
W.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9338
^ permalink raw reply [flat|nested] 3+ messages in thread
* c++/9338: ICE in peculiar templated constructors
@ 2003-01-16 9:36 martin
0 siblings, 0 replies; 3+ messages in thread
From: martin @ 2003-01-16 9:36 UTC (permalink / raw)
To: gcc-gnats
>Number: 9338
>Category: c++
>Synopsis: ICE in peculiar templated constructors
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: ice-on-legal-code
>Submitter-Id: net
>Arrival-Date: Thu Jan 16 01:36:01 PST 2003
>Closed-Date:
>Last-Modified:
>Originator: Martin Buchholz
>Release: gcc-3.2.1
>Organization:
>Environment:
Linux x86
>Description:
The file below results in ICE
g++ main.cc -o main
main.cc: In function `int main(int, char**)':
main.cc:36: internal error: Segmentation fault
Please submit a full bug report,
The file compiles (with warnings) under icc,
but fails to link.
------------------------------------------------------
class Bool
{
public:
const bool val_;
template <class T, bool condition> struct Constraint;
template <class T> struct Constraint<T,true> { typedef int Dummy; };
template <typename T> struct Convertible { enum { value = true }; };
template <typename T>
explicit
Bool (T x, typename Constraint<T, Convertible<T>::value>::Dummy = 0)
: val_ (bool (x))
{}
template <class T> struct Unlikely { enum { value = false }; };
template <typename T>
explicit
Bool (T x, typename Constraint<T, ! Convertible<T>::value>::Dummy = 0);
template <typename T>
Bool (T x, typename Constraint<T, ! Unlikely<T>::value>::Dummy = 0);
Bool (bool val) : val_ (val) {}
Bool (const Bool & val) : val_ (bool (val)) {}
struct S_ { int M_; };
operator int S_::* () const { return val_ ? & S_::M_ : 0; }
};
struct X
{
bool b;
X (bool x) : b (x) {}
struct S_ { int M_; };
operator int S_::* () const { return b ? & S_::M_ : 0; }
};
int
main (int argc, char *argv[])
{
Bool b (X (true));
}
>How-To-Repeat:
g++ main.cc -o main
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-04-07 10:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-07 10:56 c++/9338: ICE in peculiar templated constructors Giovanni Bajo
-- strict thread matches above, loose matches on Subject: below --
2003-01-16 15:12 bangerth
2003-01-16 9:36 martin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).