public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/4377: more errors with multiple non-type template parameters
@ 2002-03-18  5:50 jason
  0 siblings, 0 replies; 5+ messages in thread
From: jason @ 2002-03-18  5:50 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, jason, smacdonald

Synopsis: more errors with multiple non-type template parameters

State-Changed-From-To: analyzed->closed
State-Changed-By: jason
State-Changed-When: Mon Mar 18 05:50:35 2002
State-Changed-Why:
    Fixed for 3.1 by
            * mangle.c (write_expression): Strip NOP_EXPRs sooner.  Also strip
            NON_LVALUE_EXPRs.

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


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

* Re: c++/4377: more errors with multiple non-type template parameters
@ 2002-03-18  4:10 jason
  0 siblings, 0 replies; 5+ messages in thread
From: jason @ 2002-03-18  4:10 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, jason, nobody, smacdonald

Synopsis: more errors with multiple non-type template parameters

Responsible-Changed-From-To: unassigned->jason
Responsible-Changed-By: jason
Responsible-Changed-When: Mon Mar 18 04:10:34 2002
Responsible-Changed-Why:
    x

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


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

* Re: c++/4377: more errors with multiple non-type template parameters
@ 2002-03-13  8:56 Scott MacDonald
  0 siblings, 0 replies; 5+ messages in thread
From: Scott MacDonald @ 2002-03-13  8:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

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

From: "Scott MacDonald" <scott@iotek.ns.ca>
To: <gcc-gnats@gcc.gnu.org>, <gcc-prs@gcc.gnu.org>
Cc:  
Subject: Re: c++/4377: more errors with multiple non-type template parameters
Date: Wed, 13 Mar 2002 12:52:07 -0400

 This is an update to PR4377.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p
 r=4377
 
 This problem is also filed under PR4990 (I hadn't realized at the time how
 to update a problem report, sorry).  That report has a few more details
 posted and the results are slightly different for newer builds (both tests
 end in a segmentation fault).
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p
 r=4990
 
 This problem is still present in g++ (GCC) 3.1 20020311 (prerelease).
 


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

* Re: c++/4377: more errors with multiple non-type template parameters
@ 2002-02-26 14:24 nathan
  0 siblings, 0 replies; 5+ messages in thread
From: nathan @ 2002-02-26 14:24 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, smacdonald

Synopsis: more errors with multiple non-type template parameters

State-Changed-From-To: open->analyzed
State-Changed-By: nathan
State-Changed-When: Tue Feb 26 14:22:45 2002
State-Changed-Why:
    confirmed as a 2.95 regression

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


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

* c++/4377: more errors with multiple non-type template parameters
@ 2001-09-22 11:56 smacdonald
  0 siblings, 0 replies; 5+ messages in thread
From: smacdonald @ 2001-09-22 11:56 UTC (permalink / raw)
  To: gcc-gnats

>Number:         4377
>Category:       c++
>Synopsis:       more errors with multiple non-type template parameters
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 22 11:56:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Scott MacDonald
>Release:        gcc-3.1 snapshot of 2001-09-17
>Organization:
>Environment:
Red Hat Linux 7.1, Intel
>Description:
This problem is an extension of bug #3911.  The code posted in that report compiles fine, but the addition of another operator causes an  Internal error: Segmentation fault .

The code works fine using gcc 2.95.3 and using Comeau Computing's online compiler (4.2.45.2).

This was the result of a compile of test-1.cc (code below).
> g++ test-1.cc
test-1.cc: In function `int main()':
test-1.cc:28: 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.

For a bit more information if you add a specialization of the template with inline friends (not nice but legal and necessary on older gcc versions) the compile no longer gets an internal error, but complains about virtual functions being abstract. (code test-2.cc is below)

> g++ test-2.cc
test-2.cc:33: invalid return type for function `unit<0, 0> operator/(const
   unit<0, 0>&, const unit<0, 0>&)'
test-2.cc:33:   because the following virtual functions are abstract:
test-2.cc:30:   unit<0, 0> operator*(const unit<0, 0>&, const unit<0, 0>&)
test-2.cc:46: confused by earlier errors, bailing out

The above test also compiles find on both g++ 2.95.3 and Comeau Computing (4.2.45.2).

Scott MacDonald

code:
==========================================
test-1.cc

template < int I1, int I2 >
class unit
{
public:
  unit() {}
  unit( const unit<I1,I2>& ) {}

  template< int Q1, int Q2 >
  unit< I1 + Q1, I2 + Q2 > operator * ( const unit< Q1, Q2 >& rhs ) const {
    return unit< I1 + Q1, I2 + Q2 >();
  }
 
  template< int Q1, int Q2 >
  unit< I1 - Q1, I2 - Q2 > operator / ( const unit< Q1, Q2 >& rhs ) const {
    return unit< I1 - Q1, I2 - Q2 >();
  }
 
};
 
int main()
{
  const unit<1,0> u1;
  const unit<2,0> u2;
 
  unit<-1,0> u3( u1 / u2 );
  unit< 3,0> u4( u1 * u2 );
}

======================================
test-2.cc

template < int I1, int I2 >
class unit
{
public:
  typedef unit<I1,I2> my_type;

  unit() {}
  unit( const unit<I1,I2>& ) {}

   template< int Q1, int Q2 >
   unit< I1 + Q1, I2 + Q2 > operator * ( const unit< Q1, Q2 >& rhs ) const {
     return unit< I1 + Q1, I2 + Q2 >();
   }
 
  template< int Q1, int Q2 >
  unit< I1 - Q1, I2 - Q2 > operator / ( const unit< Q1, Q2 >& rhs ) const {
    return unit< I1 - Q1, I2 - Q2 >();
  }
};

// specialization added to first test
//
template <>
class unit<0,0> {
public:
  typedef unit<0,0> my_type;

  unit() {}
  
   friend unit<0,0> operator*( const unit<0,0>& lhs, const unit<0,0>& rhs ) {
     return unit<0,0>();
   }
   friend unit<0,0> operator/( const unit<0,0>& lhs, const unit<0,0>& rhs ) {
     return unit<0,0>();
   }

};


int main()
{
  const unit<1,0> u1;
  const unit<2,0> u2;
 
  unit<-1,0> u3( u1 / u2 );
  unit< 3,0> u4( u1 * u2 );
}

>How-To-Repeat:
g++ test-1.cc
>Fix:

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


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

end of thread, other threads:[~2002-03-18 13:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-18  5:50 c++/4377: more errors with multiple non-type template parameters jason
  -- strict thread matches above, loose matches on Subject: below --
2002-03-18  4:10 jason
2002-03-13  8:56 Scott MacDonald
2002-02-26 14:24 nathan
2001-09-22 11:56 smacdonald

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