This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problem with a map default argument initialization


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]