473,778 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_hel per(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
MetaCommunicati ons Engineering
http://www.meta-comm.com/engineering/
Nov 17 '05 #1
1 1121
>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
2567
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 forgets to implement some method I normally get a compile error(if the class is created in some way of course). When using the Visual Studio 6 compiler however, it does not generate a compile error in this case: - I have a implementing class A...
1
1199
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 internally refer to this private member (I'm not making a wrong use of the library). I was working with VC6 before and this problem did not show up (the compiler had a wrong behaviour regarding private static members). Now that I'm working with...
8
1663
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
1480
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 \C\toil.c', line 6931) I've managed to reliably reproduce it using the few lines of code below that does not use any of my own product code:
6
2730
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 facing the same problem with many of them: I keep getting errors such as: ....\WinUser.h(8028): fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 2701)
7
2241
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 optimization, but the vc7 is quite slow in comparison to the vc6 one. My timing test was rougly 71 seconds for vc6 and 103 seconds for vc7. The total number of calculations was roughly 191 million for vc6 and 89 million for vc7 after 13 seconds of run...
0
996
by: Hendrik Schober | last post by:
Hi, For this template< typename T > struct X { void f(X) {} }; template< typename T >
2
3390
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 = _afxRichEditState;
5
2885
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. I open a new project based on a windows form 2. I click on "data" and then "Add New Data Source" then I click on next within the wizard 3. I have 3 choices Database, Local Database, Web service and Object. 4. I choose Database, click next and get...
0
9629
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10298
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10069
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9923
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4033
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3627
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2865
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.