This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Problem with a map default argument initialization
- From: Phil Edwards <phil at jaj dot com>
- To: Julie Deslongchamps <JDeslon at orthosoft dot ca>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 11 Feb 2003 16:00:29 -0500
- Subject: Re: Problem with a map default argument initialization
- References: <3E3FE975.A5AD34A8@orthosoft.ca>
On Tue, Feb 04, 2003 at 11:25:25AM -0500, Julie Deslongchamps wrote:
> In the second constructor Foo(const map<string, string> &bar=map<string,
> string>());, the compiler says that there is a parse error before '>' token.
> To have a workaround, I typedefed the map and everything works fine (as showed
> in the first constructor). Am I missing something? Is there a bug with the
> compiler? I use gcc version 3.2.
The development version (with a different C++ parser) doesn't like it either
(a reduced equivalent testcase):
fenric 36% cat -n d.cc
1 #include <map>
2 #include <string>
3
4 using namespace std;
5
6 struct Foo
7 {
8 Foo (const std::map<string,string> &bar = std::map<string,string>());
9 };
10
fenric 37% ~/build/install-2003-02-05/bin/g++ -c -Wall d.cc
d.cc:8: error: ISO C++ forbids declaration of `Foo' with no type
d.cc:8: error: expected function-definition
fenric 38%
icc7 accepts it.
--
I would therefore like to posit that computing's central challenge, viz. "How
not to make a mess of it," has /not/ been met.
- Edsger Dijkstra, 1930-2002