public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/8158: Compiler rejects legal default parameter
@ 2002-10-07  5:56 m.doppler
  0 siblings, 0 replies; 2+ messages in thread
From: m.doppler @ 2002-10-07  5:56 UTC (permalink / raw)
  To: gcc-gnats; +Cc: p.klotz


>Number:         8158
>Category:       c++
>Synopsis:       Compiler rejects legal default parameter
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 07 05:56:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Michael Doppler, Peter Klotz
>Release:        gcc 3.2, gcc 3.1
>Organization:
>Environment:
Redhat 8.0, gcc 3.2, glibc 2.2.93
Redhat 7.2, gcc 3.1, glibc 2.2.4
>Description:
The following code doesn't compile although it should.

#include <map>

class A
{
public:
typedef std::map<unsigned char,int> TType;
        //A(const TType& x=TType()) // this works
        A( const std::map<unsigned char, int> & p_map = std::map<unsigned char, int>() ) // this doesn't
        {
        }
};

int main(void )
{
        A a;
        return 0;
}
>How-To-Repeat:
Compile program from description.
>Fix:
Workaround: use typedef provided in code snippet.
>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: c++/8158: Compiler rejects legal default parameter
@ 2002-10-07  9:42 nathan
  0 siblings, 0 replies; 2+ messages in thread
From: nathan @ 2002-10-07  9:42 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, m.doppler, nobody, p.klotz

Synopsis: Compiler rejects legal default parameter

State-Changed-From-To: open->closed
State-Changed-By: nathan
State-Changed-When: Mon Oct  7 09:42:34 2002
State-Changed-Why:
    not a bug. There is a defect report about this. The
    c++ std does not specify exactly when default args
    of member functions are parsed.
    Your default arg contains an unparenthesized comma.
    It is *very* hard to determine whether a '<' marks
    the start of a template parm list at that point. The
    defect report resolves this by saying the default
    arg consists of the tokens up to the next unparenthesized,
    unbracketed comma or close paren.

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


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

end of thread, other threads:[~2002-10-07 16:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-07  5:56 c++/8158: Compiler rejects legal default parameter m.doppler
2002-10-07  9:42 nathan

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