public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/10621: Calling a non-qualified member function within a sizeof() expression leads to "invalid use of undefined type"
@ 2003-05-04 14:56 giovannibajo
  0 siblings, 0 replies; 2+ messages in thread
From: giovannibajo @ 2003-05-04 14:56 UTC (permalink / raw)
  To: gcc-gnats


>Number:         10621
>Category:       c++
>Synopsis:       Calling a non-qualified member function within a sizeof() expression leads to "invalid use of undefined type"
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Sun May 04 14:56:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Giovanni Bajo
>Release:        3.3 CVS 20030503, 3.4 CVS 20030503
>Organization:
>Environment:
i686-pc-cygwin
>Description:
The following code has always been rejected by GCC:

-----------------------------------
struct Foo
{
    static int func(void);

    enum { value = sizeof(func()) };
};
-----------------------------------
gccbug1.cpp:5: error: invalid use of undefined type `struct Foo'
gccbug1.cpp:2: error: forward declaration of `struct Foo'
gccbug1.cpp:5: error: enumerator value for `value' not integer constant

Notice that it's possible to make the code compile simply 
by qualifying the function name: sizeof(Foo::func()).
>How-To-Repeat:
Compile the above snippet
>Fix:
Qualify the function name
>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: c++/10621: Calling a non-qualified member function within a sizeof() expression leads to "invalid use of undefined type"
@ 2003-05-04 16:45 bangerth
  0 siblings, 0 replies; 2+ messages in thread
From: bangerth @ 2003-05-04 16:45 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, giovannibajo, nobody

Synopsis: Calling a non-qualified member function within a sizeof() expression leads to "invalid use of undefined type"

State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Sun May  4 16:45:56 2003
State-Changed-Why:
    A duplicate of 9259

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


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

end of thread, other threads:[~2003-05-04 16:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-04 14:56 c++/10621: Calling a non-qualified member function within a sizeof() expression leads to "invalid use of undefined type" giovannibajo
2003-05-04 16:45 bangerth

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