Jul 20, 2010 at 5:20pm UTC
Hi there!
I use g++ compiler which is built-in in Code::Blocks 10.05 and I have quite strange problem while using
reinterpret_cast operator.
I'd like to convert following expression:
tolower //function's address
into:
(int (*)(int ))
If I use traditional type-casting:
int (*ptr)(int ) = (int (*)(int ))tolower;
- everything's fine.
But if I type-casting by means of
reinterpret_cast operator:
int (*ptr)(int ) = reinterpret_cast <int (*)(int )>(tolower);
I'm getting the following error:
error: overloaded function with no contextual type information
What am I doing wrong ?
Last edited on Jul 20, 2010 at 5:22pm UTC
Jul 20, 2010 at 7:30pm UTC
It compiles for me.
g++ (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Jul 20, 2010 at 9:06pm UTC
Then I don't know what's going on... :-/
Jul 21, 2010 at 12:59am UTC
From the error it sounds like you've written a second tolower (hence the complaint
about overloading)?