public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/7089: reinterpret_cast forbids cast void* to function pointer
@ 2002-06-20 12:31 rdabrowa
0 siblings, 0 replies; 2+ messages in thread
From: rdabrowa @ 2002-06-20 12:31 UTC (permalink / raw)
To: gcc-gnats
>Number: 7089
>Category: c++
>Synopsis: reinterpret_cast forbids cast void* to function pointer
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Thu Jun 20 12:26:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Rafal Dabrowa
>Release: vary (2.96, 3.1)
>Organization:
>Environment:
>Description:
Compiler does not allow to cast pointer to object to pointer to function and vice versa, using reinterpret_cast operator. ISO forbids such operation for all other casts, but NOT for reinterpret_cast.
>How-To-Repeat:
Compile the following function:
void f(void *pv)
{
void (*pf)() = reinterpret_cast<void(*)()>(pv);
}
The following error message appears:
cast1.cc: In function `void f(void*)':
cast1.cc:4: ISO C++ forbids casting between pointer-to-function and pointer-to-object
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: c++/7089: reinterpret_cast forbids cast void* to function pointer
@ 2002-06-21 7:56 nathan
0 siblings, 0 replies; 2+ messages in thread
From: nathan @ 2002-06-21 7:56 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, nobody, rdabrowa
Synopsis: reinterpret_cast forbids cast void* to function pointer
State-Changed-From-To: open->closed
State-Changed-By: nathan
State-Changed-When: Fri Jun 21 06:18:27 2002
State-Changed-Why:
not a bug. You cannot reinterpret cast a pointer
to function into a pointer to object. Nothing in
[5.2.10] allows that.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7089
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-06-21 13:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-20 12:31 c++/7089: reinterpret_cast forbids cast void* to function pointer rdabrowa
2002-06-21 7:56 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).