public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13500] New: reinterpret_cast allows a function to be called with too few paremeters
@ 2003-12-28 4:25 japple at freeshell dot org
2003-12-28 4:31 ` [Bug c++/13500] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: japple at freeshell dot org @ 2003-12-28 4:25 UTC (permalink / raw)
To: gcc-bugs
void f0(int = 5) {}
void f1(int = 2) {}
void f_(int) {}
template<typename T>
void back_forth(T * y) {
reinterpret_cast<T *>(reinterpret_cast<void (*)()>(y))();
}
int main() {
//back_forth(f_); //fails!
back_forth(f0);
back_forth(f1);
back_forth(f_); //succeeds!
}
In addition, the call to f1 inside back_forth(f1) thinks the argument is 5, not 2.
--
Summary: reinterpret_cast allows a function to be called with
too few paremeters
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: japple at freeshell dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i386-pc-linux-gnu
GCC host triplet: i386-pc-linux-gnu
GCC target triplet: i386-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13500
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/13500] reinterpret_cast allows a function to be called with too few paremeters
2003-12-28 4:25 [Bug c++/13500] New: reinterpret_cast allows a function to be called with too few paremeters japple at freeshell dot org
@ 2003-12-28 4:31 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-28 4:31 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-12-28 04:12 -------
This is a dup of bug 4205, the reinterpret_cast is not needed.
*** This bug has been marked as a duplicate of 4205 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13500
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-12-28 4:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-28 4:25 [Bug c++/13500] New: reinterpret_cast allows a function to be called with too few paremeters japple at freeshell dot org
2003-12-28 4:31 ` [Bug c++/13500] " pinskia at gcc dot gnu dot org
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).