Opened 14 years ago

Last modified 10 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?

Change History (2)

comment:1 by oliora@…, 10 years ago

Version: Boost 1.36.0Boost 1.51.0

Get the same problem in Boost 1.51.0 with VC9

comment:2 by oliora@…, 10 years ago

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

Note: See TracTickets for help on using tickets.