This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/1914
- To: nobody at gcc dot gnu dot org
- Subject: Re: c++/1914
- From: "Richard B. Kreckel" <kreckel at ginac dot de>
- Date: 17 Feb 2001 20:36:00 -0000
- Cc: gcc-prs at gcc dot gnu dot org,
- Reply-To: "Richard B. Kreckel" <kreckel at ginac dot de>
The following reply was made to PR c++/1914; it has been noted by GNATS.
From: "Richard B. Kreckel" <kreckel@ginac.de>
To: Craig Rodrigues <rodrigc@mediaone.net>
Cc: gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org
Subject: Re: c++/1914
Date: Sat, 17 Feb 2001 21:30:38 +0100 (CET)
On Sat, 17 Feb 2001, Craig Rodrigues wrote:
> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=1914&database=gcc
>
> Tested this with:
> gcc version 2.97 20010211 (experimental)
> from: http://www.codesourcery.com/gcc-snapshots/
>
> The testcase successfully compiled.
See below...
> Should this report be closed?
No, this report should not be closed.
The testcase compiled successfully because the line that causes trouble
was commented out. Please do read the comments. I just checked it with
version 20010217 and the uncommented line 10 still gives a parser error
before `>' token:
#include <utility> // defines pair template
#include <iostream>
using namespace std;
typedef pair<int, int> ijpair;
class foo {
public:
// this does not work,...
foo( pair < int, int > ij = pair < int, int > ( 0, 0 ) ) : indices (ij) { }
// ...but this does:
// foo( pair<int,int> ij = ijpair(0,0) ) : indices(ij) { }
void displayme() { cout << indices.first << ',' << indices.second << endl; }
private:
pair<int, int> indices;
};
int pairsum(pair<int,int> ij = pair<int,int>(0,0))
{
return ij.first+ij.second;
}
int main(void)
{
foo f1 = foo(pair<int, int>(42,7));
foo f2 = foo();
f1.displayme();
f2.displayme();
cout << pairsum() << endl;
return 0;
}
Regards
-richy.
--
Richard Kreckel
<Richard.Kreckel@Uni-Mainz.DE>
<http://wwwthep.physik.uni-mainz.de/~kreckel/>