public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/6628: cannot typedef const functions
@ 2002-05-10 13:56 ge
0 siblings, 0 replies; 3+ messages in thread
From: ge @ 2002-05-10 13:56 UTC (permalink / raw)
To: gcc-gnats; +Cc: cannot, typedef, const, functions
>Number: 6628
>Category: c++
>Synopsis: cannot typedef const functions
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri May 10 13:56:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: ge@cs.twsu.edu
>Release: gcc version 3.0.4
>Organization:
>Environment:
gcc version 3.0.4 (Mandrake Linux 8.2 3.0.4-2mdk)
>Description:
// t.cc
#include <string>
struct Person { void print (); std::string name_; };
typedef void (Person::*MF)() const;
typedef void FVC (void) const;
The last line caused the following error message:
t.cc:4: invalid type qualifier for non-member function type
t.cc:4: `const' and `volatile' function specifiers on `FVC' invalid in type
>How-To-Repeat:
cut and paste the 4 lines of source code to a file, and the
compile it with g++-3.0.4.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: c++/6628: cannot typedef const functions
@ 2002-06-07 7:35 lerdsuwa
0 siblings, 0 replies; 3+ messages in thread
From: lerdsuwa @ 2002-06-07 7:35 UTC (permalink / raw)
To: cannot, typedef, const, functions, gcc-bugs, gcc-prs, ge, nobody
Synopsis: cannot typedef const functions
State-Changed-From-To: open->closed
State-Changed-By: lerdsuwa
State-Changed-When: Fri Jun 7 07:35:13 2002
State-Changed-Why:
Not a bug.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6628
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: c++/6628: cannot typedef const functions
@ 2002-05-10 14:06 Phil Edwards
0 siblings, 0 replies; 3+ messages in thread
From: Phil Edwards @ 2002-05-10 14:06 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/6628; it has been noted by GNATS.
From: Phil Edwards <phil@jaj.com>
To: ge@cs.twsu.edu
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/6628: cannot typedef const functions
Date: Fri, 10 May 2002 17:03:55 -0400
On Fri, May 10, 2002 at 08:52:39PM -0000, ge@cs.twsu.edu wrote:
> typedef void (Person::*MF)() const;
> typedef void FVC (void) const;
>
> The last line caused the following error message:
> t.cc:4: invalid type qualifier for non-member function type
> t.cc:4: `const' and `volatile' function specifiers on `FVC' invalid in type
Yeah... so.... what's the problem? :-)
'const' is only allowed to modify member functions, not non-member functions.
The typedef has nothing to do with it:
29% cat q.cc
void f() const
{
}
30% g++ -c q.cc
q.cc:3: non-member function `void f()' cannot have `const' method qualifier
31%
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-06-07 14:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-10 13:56 c++/6628: cannot typedef const functions ge
2002-05-10 14:06 Phil Edwards
2002-06-07 7:35 lerdsuwa
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).