Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4593 closed Bugs (fixed)

Type_of does not use BOOST_TYPEOF_EMULATION for VC10 and \Za

Reported by: Paul A. Bristow Owned by: Peder Holt
Milestone: Boost 1.45.0 Component: typeof
Version: Boost Development Trunk Severity: Problem
Keywords: type_of Cc:

Description

Type_of does not use BOOST_TYPEOF_EMULATION for VC10 and \Za.

For example boost/math/libs/test/pow_test.cpp

fails to compile with \Za (No MS extensions)

I:\boost-trunk\boost/typeof/msvc/typeof_impl.hpp(125): error C2143: syntax error : missing ';' before '<'

I:\boost-trunk\boost/typeof/msvc/typeof_impl.hpp(133) : see reference to class template instantiation 'boost::type_of::msvc_extract_type<ID,T>' being compiled

I:\boost-trunk\boost/typeof/msvc/typeof_impl.hpp(125): error C2913: explicit specialization; 'boost::type_of::msvc_extract_type<ID,boost::type_of::msvc_extract_type_default_param>::id2type_impl' is not a specialization of a class template I:\boost-trunk\boost/typeof/msvc/typeof_impl.hpp(125): error C2059: syntax error : '<' I:\boost-trunk\boost/typeof/msvc/typeof_impl.hpp(126): error C2334: unexpected token(s) preceding '{'; skipping apparent function body

using native typeof

I:\boost-trunk\boost/typeof/msvc/typeof_impl.hpp(125): error C2143: syntax error : missing ';' before '<' ...

#define BOOST_TYPEOF_NATIVE

produces same error

#define BOOST_TYPEOF_EMULATION

Works OK

pow_test.cpp

using typeof emulation Generating code

...

Would I be right in hoping that native type_of would be used for VC10?

(I note tests for VC >= 1400 but none for later versions).

Or that emulation would be selected automatically for VC10?

Or does using \Za mean type_of cannot be used?

Change History (6)

comment:1 by Paul A. Bristow, 12 years ago

And BTW, the docs haven't kept up with these (new?) macros BOOST_TYPEOF_NATIVE and BOOST_TYPEOF_EMULATION and perhaps others (is switch for compilation with C++0x on/off?).

comment:2 by Steven Watanabe, 12 years ago

Is there a predefined macro to detect /Za?

comment:3 by Steven Watanabe, 12 years ago

Okay, it's _MSC_EXTENSIONS.

comment:4 by Peder Holt, 12 years ago

I tried replacing the msvc hack with decltype for VC10, but had some problems with ensure_obj for functions. I allso note that BOOST_NO_DECLTYPE is defined for this compiler, so the best approach is probably to revert to typeof emulation when _MSC_EXTENSIONS is defined. I will try to implement this later today.

comment:5 by Peder Holt, 12 years ago

Milestone: To Be DeterminedBoost-1.45.0
Resolution: fixed
Status: newclosed

This should now be fixed. When _MSC_EXTENSIONS is defined, BOOST_TYPEOF_EMULATION will be defined.

comment:6 by Paul A. Bristow, 12 years ago

This seems to have cured the failures in Boost.Math pow_test. Thanks.

Note: See TracTickets for help on using tickets.