473,406 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

ISO C++ forbids declaration of `result_type' with no type

Hi,

I am get compilation error when using gcc 3.4 on i386 platform related to template :

ERROR MESSAGE:
include/template:168: error: ISO C++ forbids declaration of `result_type' with no type
include/template:168: error: expected `;' before "operator"
/include/template:171: error: expected `;' before "protected"


SOURCE FILE:

template<class _Bfn>
class binder1st
: public unary_function<typename _Bfn::second_argument_type, typename _Bfn::result_type> {

public:
binder1st(const _Bfn& _X,
const typename _Bfn::first_argument_type& _Y) : op(_X), value(_Y) {}
result_type operator()(const argument_type& _X) const // Error here ! Line 168
{return (op(value, _X)); }

protected:
_Bfn op;
typename _Bfn::first_argument_type value;

};



Everything use to run fine on gcc 3.3.x. Any suggestion to fix this issue ? Thanks



Best Regards
Kelvin Lim
Jul 20 '07 #1
3 2597
gpraghuram
1,275 Expert 1GB
Hi,

I am get compilation error when using gcc 3.4 on i386 platform related to template :

ERROR MESSAGE:
include/template:168: error: ISO C++ forbids declaration of `result_type' with no type
include/template:168: error: expected `;' before "operator"
/include/template:171: error: expected `;' before "protected"


SOURCE FILE:

template<class _Bfn>
class binder1st
: public unary_function<typename _Bfn::second_argument_type, typename _Bfn::result_type> {

public:
binder1st(const _Bfn& _X,
const typename _Bfn::first_argument_type& _Y) : op(_X), value(_Y) {}
result_type operator()(const argument_type& _X) const // Error here ! Line 168
{return (op(value, _X)); }

protected:
_Bfn op;
typename _Bfn::first_argument_type value;

};



Everything use to run fine on gcc 3.3.x. Any suggestion to fix this issue ? Thanks



Best Regards
Kelvin Lim

Hi
Can you post some more code where the error is occuring?
Do post with code tags

Raghuram
Jul 20 '07 #2
Hi,

Here it is :


template<class _A, class _R>
struct unary_function {
typedef _A argument_type;
typedef _R result_type;
};


template<class _Bfn>
class binder1st : public unary_function<typename _Bfn::second_argument_type, typename _Bfn::result_type>
{
public:
binder1st(const _Bfn& _X, const typename _Bfn::first_argument_type& _Y) : op(_X), value(_Y) {}

result_type operator()(const argument_type& _X) const
{return (op(value, _X)); }
protected:
_Bfn op;
typename _Bfn::first_argument_type value;
};

int main()
{
}


COMPILATION ERROR :
main.cpp:15: error: ISO C++ forbids declaration of `result_type' with no type
main.cpp:15: error: expected `;' before "operator"
main.cpp:17: error: expected `;' before "protected"




Thanks :)
Jul 20 '07 #3
weaknessforcats
9,208 Expert Mod 8TB
This compiles without error using Visual Studio.NET 2005.
Jul 22 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Emmanuel Deloget | last post by:
Hello, I'm trying to find a (sfinae powered) way to verify if a particular type declares a subtype (either using typedef or by declaring a subclass). To be more concrete, let's say that I'm...
20
by: curious2007 | last post by:
I have the following program: #include "Vector.cpp" #include <iostream> using namespace std; template<class Arg1, class Arg2, class Result> struct binary_function
6
by: samsneelam | last post by:
Hi.. This is samuel, while doing a program, i encountered this problem.. Let me give you clarity regarding my prob.. I am having two files .. one is mpcplib.h it contains the follwing...
10
by: tvnaidu | last post by:
I am using Three pthread functions below, I got ISO error, then I declared int variable called val123, then I assigned, but still I am getting error, any idea?. also I included pthread.h. compiling...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.