[g++] Getting an error while using reinterpret_cast operator

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
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.
Then I don't know what's going on... :-/
From the error it sounds like you've written a second tolower (hence the complaint
about overloading)?
using namespace std?

there is a tolower in namespace std;

 
template<typename _CharT> _CharT tolower (_CharT __c, const locale &__loc)
Topic archived. No new replies allowed.