473,385 Members | 1,597 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

BUG (VC7.1 and Whidbey): compiler allows access to private definitions in some cases

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)?

--
Maxim Yegorushkin
MetaCommunications Engineering
http://www.meta-comm.com/engineering/
Nov 17 '05 #1
1 1106
>Code to reproduce the bug (Comeau refuses to compile the code, but VC has
no complain about it):


I've passed your report on to MS.

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Bjorn | last post by:
I'm using interfaces in C++ by declaring classes with only pure virtual methods. If then someone wants to implement the interface they needs to inherit from the class. If the implementing class...
1
by: gein.julien | last post by:
Hi, I'm currently working with a rather old library which declares a member of a parent class as private while it should be protected. The library then provides macros for the child classes that...
8
by: Andrew Maclean | last post by:
Does VC7.1 support hyperthreading? I looked in the documentation but I could find no reference at all.
1
by: CB | last post by:
I'm upgrading our product from VC6 to the VC7 compiler and came across the C1001 error: fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'f:\vs70builds\3077\vc\Compiler\CxxFE\sl\P1...
6
by: David Lack | last post by:
Hi, I recently installed a 60-day trial of .NET 2003 on my development system. I made tests with previous personal projects (which compiled ok with VC6) and some open source files, and keep...
7
by: Brian | last post by:
Hi, I have been trying to tune my vc7 compiled applications to perform at the same or (preferably) better speed of the same vc6 application. Both versions of my code are compiled with...
0
by: Hendrik Schober | last post by:
Hi, For this template< typename T > struct X { void f(X) {} }; template< typename T >
2
by: Senapathy | last post by:
VC++ .NET 2003 Standard Edition Win XP, SP2 Hi, I have a code that builds under VC6.0, but fails to link in VC7.1. The offending code is as follows: _AFX_RICHEDIT_STATE* const pEditState...
5
by: rogsonl | last post by:
My computer was moved last week, and the company changed the network groups we work on. As a result, one of the main benefits from Whidbey (database connectivity) no longer works. Situation: 1....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.