boostorg / boostorg/type_traits

is_base<T, T> is broken on MSVC10 when T is not defined

Open
#82 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
66
Forks
87
PR merge metrics
No merged PRs in 30d

Description

Currently on Windows with MSVC10 boost defines BOOST_IS_BASE_OF (which is used in is_base_and_derived, which is used in is_base_of) as follows:
```
#define BOOST_IS_BASE_OF(T,U) (__is_base_of(T,U) && !is_same::value)
```
But microsoft's intrinsic __is_base_of cannot be used with the same type (i.e. T = U) when it (the type) is not defined.

When the following is compiled
```
class A;
typedef typename boost::is_base_of::type x;
```
you get an error message:
```
...\include\boost\type_traits\is_base_and_derived.hpp(228) : error C2139: 'A' : an undefined class is not allowed as an argument to compiler intrinsic type trait '__is_base_of'
...\include\boost\type_traits\is_base_of.hpp(29) : see reference to class template instantiation 'boost::detail::is_base_and_derived_impl' being compiled
with
[
B=A,
D=A
]
```
The same code compiles on gcc-4.8.2 and clang-3.6.

Moved from https://svn.boost.org/trac10/ticket/11422

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.