public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/4526: ICE in g++ 3.0.1 when using typeof() as template parameter
@ 2002-12-04  4:46 Volker Reichelt
  0 siblings, 0 replies; 5+ messages in thread
From: Volker Reichelt @ 2002-12-04  4:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/4526; it has been noted by GNATS.

From: Volker Reichelt <reichelt@igpm.rwth-aachen.de>
To: gcc-gnats@gcc.gnu.org, grey.havens@earthling.net, gcc-bugs@gcc.gnu.org,
        nobody@gcc.gnu.org
Cc:  
Subject: Re: c++/4526: ICE in g++ 3.0.1 when using typeof() as template parameter
Date: Wed, 4 Dec 2002 14:38:36 +0100

 Hi,
 
 here's a little cleaned-up testcase that should compile without error
 (it actually compiles, if you replace "typeof(x)" by "X"):
 
 -----------------------------------snip here-------------------------
 struct X { typedef int type; };
 X x;
 
 template <typename T> struct A {
     typedef typename T::type type;
 };
 
 template <typename T> struct B {
     A<typeof(x)>::type y;
 };
 
 template class B<int>;
 -----------------------------------snip here-------------------------
 
 Regards,
 Volker
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=4526
 
 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: c++/4526: ICE in g++ 3.0.1 when using typeof() as template parameter
@ 2002-11-01 12:06 Wolfgang Bangerth
  0 siblings, 0 replies; 5+ messages in thread
From: Wolfgang Bangerth @ 2002-11-01 12:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/4526; it has been noted by GNATS.

From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c++/4526: ICE in g++ 3.0.1 when using typeof() as template
 parameter
Date: Fri, 1 Nov 2002 14:03:42 -0600 (CST)

 Whoever looks at this should also look at PRs 5750 and 8007.
 W.
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth              email:           bangerth@ticam.utexas.edu
                                www: http://www.ticam.utexas.edu/~bangerth
 
 
 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: c++/4526: ICE in g++ 3.0.1 when using typeof() as template parameter
@ 2002-10-31 14:06 Wolfgang Bangerth
  0 siblings, 0 replies; 5+ messages in thread
From: Wolfgang Bangerth @ 2002-10-31 14:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/4526; it has been noted by GNATS.

From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: gcc-bugs@gcc.gnu.org, <gcc-gnats@gcc.gnu.org>
Cc:  
Subject: Re: c++/4526: ICE in g++ 3.0.1 when using typeof() as template
 parameter
Date: Thu, 31 Oct 2002 16:04:21 -0600 (CST)

 This is a reduced testcase:
 ----------------------------------
 template<class T> struct A {
     typedef typename T::type type;
 };
 
 template<class T> struct B {
     void foo() {
         typedef A<typeof(BOGUS)> A;
         typename A::type i;
       }
 };
 
 template class B<int>;
 ----------------------------------
 
 In the original report, BOGUS was actually something valid, but I believe 
 that the failure is the same:
 tmp/g> /home/bangerth/bin/gcc-3.3-pre/bin/c++ -c x.cc
 x.cc: In instantiation of `A<__typeof (BOGUS)>':
 x.cc:8:   instantiated from here
 x.cc:2: 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.
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth              email:           bangerth@ticam.utexas.edu
                                www: http://www.ticam.utexas.edu/~bangerth
 
 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: c++/4526: ICE in g++ 3.0.1 when using typeof() as template parameter
@ 2002-05-19  4:01 lerdsuwa
  0 siblings, 0 replies; 5+ messages in thread
From: lerdsuwa @ 2002-05-19  4:01 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, grey.havens, nobody

Synopsis: ICE in g++ 3.0.1 when using typeof() as template parameter

State-Changed-From-To: open->analyzed
State-Changed-By: lerdsuwa
State-Changed-When: Sun May 19 04:01:53 2002
State-Changed-Why:
    ICE confirmed on 3.1 branch and main trunk.  
    Note that typeof is a GCC extension, not in
    the C++ standard.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=4526


^ permalink raw reply	[flat|nested] 5+ messages in thread

* c++/4526: ICE in g++ 3.0.1 when using typeof() as template parameter
@ 2001-10-10 11:26 Raphael Poss
  0 siblings, 0 replies; 5+ messages in thread
From: Raphael Poss @ 2001-10-10 11:26 UTC (permalink / raw)
  To: gcc-gnats; +Cc: regis

>Number:         4526
>Category:       c++
>Synopsis:       ICE in g++ 3.0.1 when using typeof() as template parameter
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 10 11:26:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        3.0.1
>Organization:
ENST
>Environment:
System: SunOS merlin 5.8 Generic_108528-03 sun4u sparc SUNW,Ultra-5_10
Architecture: sun4

	
host: sparc-sun-solaris2.8
build: sparc-sun-solaris2.8
target: sparc-sun-solaris2.8
configured with: ../configure --prefix=~/gcc --enable-languages=c,c++ : (reconfigured) ../configure --prefix=/infres/ir30/infstag/poss/gcc --enable-languages=c,c++
>Description:

G++ 3.0.1 doesn't like the use of typeof() to give a
type parameter to a template structure.

Given the following code:

template<class T>
struct get_begin
{
  typedef typename T::iterator iterator;
  static iterator begin(T& c)
  {
    return c.begin();
  }
};

template<class T>
struct something_t
{
  typedef T some_container;
  void doit(void)
  {
    some_container a;
    typedef get_begin<typeof(a)> my_get_begin; // here is the problem
    typename my_get_begin::iterator i;
  }
};

then G++ 3.0.1 will choke on instanciation of something_t, like in the
following code :

#include <list>

int main(void)
{
 something_t<std::list<int> > something;
}

The error message is :

e.cc: In instantiation of `get_begin<__typeof (a(>':
e.cc:19:   instantiated from here
e.cc:4: Internal 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.

>How-To-Repeat:

# 1 "e.cc"
template<class T>
struct get_begin
{
  typedef typename T::iterator iterator;
  static iterator begin(T& c)
  {
    return c.begin();
  }
};

template<class T>
struct something_t
{
  typedef T some_container;
  void doit(void)
  {
    some_container a;
    typedef get_begin<typeof(a)> my_get_begin;
    typename my_get_begin::iterator i;
  }
};

// inclusion of <list> stripped

# 24 "e.cc" 2

int main(void)
{
 something_t<std::list<int> > something;
}

>Fix:

replace
   typedef get_begin<typeof(a)> my_get_begin;
by
   typedef get_begin<some_container> my_get_begin;


>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-12-04 12:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-04  4:46 c++/4526: ICE in g++ 3.0.1 when using typeof() as template parameter Volker Reichelt
  -- strict thread matches above, loose matches on Subject: below --
2002-11-01 12:06 Wolfgang Bangerth
2002-10-31 14:06 Wolfgang Bangerth
2002-05-19  4:01 lerdsuwa
2001-10-10 11:26 Raphael Poss

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).