M
Maxim Yegorushkin
Code to reproduce the bug (Comeau refuses to compile the code, but VC has
no complain about it):
template<class T, class S>
class M
{
private:
struct m_tag;
};
template<class T>
struct is_m
{
template<class U>
static char is_m_helper(U*, typename U::m_tag*);
static double is_m_helper(...);
static T* t;
enum { value = sizeof(is_m_helper(t, 0)) == sizeof(char) };
};
struct A : M<void, void> {};
struct B;
class C : private M<void, void> {};
typedef char a[is_m<A>::value]; // must not compile
typedef char b[!is_m<B>::value];
typedef char c[is_m<C>::value]; // must not compile
m_tag is a private nested struct declaration. How does it come out that
is_m_helper() has access to it (after SFINAE has been applied)?
no complain about it):
template<class T, class S>
class M
{
private:
struct m_tag;
};
template<class T>
struct is_m
{
template<class U>
static char is_m_helper(U*, typename U::m_tag*);
static double is_m_helper(...);
static T* t;
enum { value = sizeof(is_m_helper(t, 0)) == sizeof(char) };
};
struct A : M<void, void> {};
struct B;
class C : private M<void, void> {};
typedef char a[is_m<A>::value]; // must not compile
typedef char b[!is_m<B>::value];
typedef char c[is_m<C>::value]; // must not compile
m_tag is a private nested struct declaration. How does it come out that
is_m_helper() has access to it (after SFINAE has been applied)?