Modify

Opened 9 years ago

Last modified 5 years ago

#2289 new Bugs

Problem with BOOST_AUTO and this keyword on VC8/9

Reported by: Richard Webb <Richard.Webb@…> Owned by: Peder Holt
Milestone: Boost 1.37.0 Component: typeof
Version: Boost 1.51.0 Severity: Problem
Keywords: Cc:

Description

On both VC8SP1 and VC9SP1, the code

struct foo
{
	int i;

	foo::foo()
	{
		BOOST_AUTO(j, this->i);
	}
};

results in the compiler error

error C2355: 'this' : can only be referenced inside non-static member functions
error C2227: left of '->i' must point to class/struct/union/generic type

error C2955: 'boost::type_of::msvc_typeid_wrapper' : use of class template requires template argument list
        e:\boostsvn\boost\typeof\msvc\typeof_impl.hpp(209) : see declaration of 'boost::type_of::msvc_typeid_wrapper'

In both cases, changing it to simply BOOST_AUTO(j, i); allows it to compile.

The foreach lib used to have a similar problem (Ticket #1652), possibly down to the same compiler bug?

Attachments (0)

Change History (2)

comment:1 Changed 5 years ago by oliora@…

Version: Boost 1.36.0Boost 1.51.0

Get the same problem in Boost 1.51.0 with VC9

comment:2 Changed 5 years ago by oliora@…

BOOST_AUTO(handler, boost::bind(&Foo::bar, this)); 'this' is a Foo*

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Peder Holt.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.