Opened 13 years ago

Closed 12 years ago

#4141 closed Bugs (invalid)

typeof/msvc/typeof_impl specializes base class template in derived class

Reported by: jhs@… Owned by: Peder Holt
Milestone: Boost 1.43.0 Component: typeof
Version: Boost 1.42.0 Severity: Problem
Keywords: Cc:

Description

This pieces of code from boost/typeof/msvc/typeof_impl.hpp (line 121 in 1.42.0) specializes the base class id2type_tmpl and then declares a local template with the same name. It is marked as a VC8 bugfeature, but I don't know if that is for this reason, or just because it uses the Microsoft in-class specialization feature.

We ran into this because our failure to accept this was reported as a bug in the EDG front end's MIcrosoft mode.

template<typename ID, typename T>

struct msvc_extract_type : msvc_extract_type<ID,msvc_extract_type_default_param> {

template<> struct id2type_impl<true> VC8.0 specific bugfeature {

typedef T type;

}; template<bool> struct id2type_impl;

typedef id2type_impl<true> id2type;

};

Change History (4)

comment:1 by Steven Watanabe, 13 years ago

I believe that it is marked as a bugfeature because it specializes a base class template. The tricks needed to make MSVC 8 and up accept a specialization of a base class template in a derived class are fairly arcane. It only worked when the base class and the derived class were both specializations of the same template. Also, declaring another id2type_impl in the derived class appears to be unnecessary. I commented it out, and the tests still pass.

comment:2 by jhs@…, 13 years ago

Is is possible to define the specializaiton of id2_type_impl<true> in the base class instead of the derived class?

comment:3 by Steven Watanabe, 13 years ago

No. That's why this hack is only enabled for specific versions of MSVC.

comment:4 by Steven Watanabe, 12 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.