public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/3911: error with multiple non-type template parameters
@ 2001-08-23 6:51 lerdsuwa
0 siblings, 0 replies; 4+ messages in thread
From: lerdsuwa @ 2001-08-23 6:51 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, lerdsuwa, smacdonald
Synopsis: error with multiple non-type template parameters
State-Changed-From-To: analyzed->closed
State-Changed-By: lerdsuwa
State-Changed-When: Thu Aug 23 06:51:19 2001
State-Changed-Why:
Fixed in the main line and gcc 3.0 branch.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3911&database=gcc
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: c++/3911: error with multiple non-type template parameters
@ 2001-08-10 6:56 lerdsuwa
0 siblings, 0 replies; 4+ messages in thread
From: lerdsuwa @ 2001-08-10 6:56 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, lerdsuwa, nobody, smacdonald
Synopsis: error with multiple non-type template parameters
Responsible-Changed-From-To: unassigned->lerdsuwa
Responsible-Changed-By: lerdsuwa
Responsible-Changed-When: Fri Aug 10 06:56:41 2001
Responsible-Changed-Why:
Patch in the work.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3911&database=gcc
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: c++/3911: error with multiple non-type template parameters
@ 2001-08-05 1:44 lerdsuwa
0 siblings, 0 replies; 4+ messages in thread
From: lerdsuwa @ 2001-08-05 1:44 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, nobody, smacdonald
Synopsis: error with multiple non-type template parameters
State-Changed-From-To: open->analyzed
State-Changed-By: lerdsuwa
State-Changed-When: Sun Aug 5 01:44:01 2001
State-Changed-Why:
Confirm as a bug. A regression from 2.95.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3911&database=gcc
^ permalink raw reply [flat|nested] 4+ messages in thread
* c++/3911: error with multiple non-type template parameters
@ 2001-08-01 10:56 smacdonald
0 siblings, 0 replies; 4+ messages in thread
From: smacdonald @ 2001-08-01 10:56 UTC (permalink / raw)
To: gcc-gnats
>Number: 3911
>Category: c++
>Synopsis: error with multiple non-type template parameters
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Wed Aug 01 10:56:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Scott MacDonald
>Release: GCC 3.0
>Organization:
>Environment:
Red Hat Linux 6.2, Intel
>Description:
g++ seems to have a problem with more than one non-type template parameter, ints in this case.
The code works fine using g++ ( 2.95.2 on Redhat 6.2), aCC (3.27 on HP-UX 11.0), and Comeau C++ (4.2.45.2 online version). As of Augest 1, 2001 it fails on Code Sourcery's nightly build test site (great idea by the way).
This was the results of a compile (error1.cc is below)
> g++ error1.cc
error1.cc: In function `int main()':
error1.cc:21: non-constant `-0' cannot be used as template argument
error1.cc:21: no match for `const unit<1, 0>& / const unit<2, 0>&' operator
template argument
In this example all of the template parameters are either literals or as a direct result of subtracting other template parameters. None of the parameters should be non-constant.
As an interesting note if you only use one template parameter instead of two it compiles fine. To see the results of this compile works.cc:
> g++ works.cc
I hope this helps and I am looking forward to using the new release.
Scott MacDonald
CODE:
==============
error1.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 >();
}
};
int main()
{
const unit<1,0> u1;
const unit<2,0> u2;
unit<-1,0> u3( u1 / u2 );
}
=================
works.cc
template < int I1 >
class unit
{
public:
unit() {}
unit( const unit<I1>& ) {}
template< int Q1 >
unit< I1 - Q1 > operator / ( const unit< Q1 >& rhs ) const {
return unit< I1 - Q1 >();
}
};
int main()
{
const unit<1> u1;
const unit<2> u2;
unit<-1> u3( u1 / u2 );
}
>How-To-Repeat:
g++ error1.cc
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-08-23 6:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-23 6:51 c++/3911: error with multiple non-type template parameters lerdsuwa
-- strict thread matches above, loose matches on Subject: below --
2001-08-10 6:56 lerdsuwa
2001-08-05 1:44 lerdsuwa
2001-08-01 10: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).