Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Bug in visual c++ 2010 with standard conforming code.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
16 replies to this topic

#1 IFooBar   Members   -  Reputation: 906

Like
0Likes
Like

Posted 24 August 2011 - 04:12 PM

Hi, I think there's a possible bug in the c++ compiler that ships with vs 2010. I tried the same code in gcc and it worked fine (unless I was compiling it wrong...). The bug can be reproduced with the following code:

[source lang='cpp']template <typename T> struct A { void f1(){} void f1() const {} };template <typename T> struct B : A<T> { using A<T>::f1; };struct __declspec(dllexport) C : B<int> {};[/source]

I'm quite sure the code above is standard conforming. The error you get is error C2487: member of dll interface class may not be declared with dll interface. But, I do not see how that applies in this situation. If you remove the using statement in B then the error goes, and if you remove either overload of the member function of A the error also goes away.

So I guess it's more because of the overloaded member function in A and not B. Also, if you inherit directly from A then the error also disappears.

Sponsor:

#2 SiCrane   Moderators   -  Reputation: 9662

Like
0Likes
Like

Posted 24 August 2011 - 04:19 PM

If you use vendor extensions, which includes __declspec, then there's no way that the concept of standard conforming applies.

#3 TheUnbeliever   Members   -  Reputation: 961

Like
0Likes
Like

Posted 24 August 2011 - 04:19 PM

Isn't declspec completely non-standard?
[TheUnbeliever]

#4 IFooBar   Members   -  Reputation: 906

Like
0Likes
Like

Posted 24 August 2011 - 05:18 PM

Way to miss the point...

The point is that the piece of code should not be problematic AFAIK. Unless Im missing something. Use whatever you need to use to export the code in to a library. MSVC uses declspec dllexport. I did not use declspec when compiling with gcc, obviously, since I was not testing out MSVC's specific extension. Though in this case it might be a bug with the way declspec is implemented. Unless (now here's the point of the post) there's something wrong with the code.

#5 ApochPiQ   Moderators   -  Reputation: 16386

Like
0Likes
Like

Posted 24 August 2011 - 06:10 PM

Why are you asking us? If you've found a reproducible bug in the VC++ compiler, why not ask Microsoft?

#6 Hodgman   Moderators   -  Reputation: 31785

Like
2Likes
Like

Posted 24 August 2011 - 06:34 PM

Why are you asking us? If you've found a reproducible bug in the VC++ compiler, why not ask Microsoft?

Because most people who think they've found a compiler bug are mistaken, and this is a decent place for finding corrections in bad code?

#7 mhagain   Crossbones+   -  Reputation: 8275

Like
0Likes
Like

Posted 24 August 2011 - 07:03 PM

Besides which, every compiler has bugs. This is nothing dramatic; you work around it and move on.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#8 ApochPiQ   Moderators   -  Reputation: 16386

Like
0Likes
Like

Posted 24 August 2011 - 08:01 PM

Because most people who think they've found a compiler bug are mistaken, and this is a decent place for finding corrections in bad code?


My point is that this would probably be a better venue for the question, for three reasons:

  • It offers just as much exposure to expert examination as GDNet, if not more, in case the problem really was flawed code;
  • It offers access to actual Visual C++ developers who can help confirm if this really is a bug;
  • It provides exposure of the issue to those same VC++ developers so they can actually do something about it.
Nobody has offered even a suggestion that the code itself is to blame, so the logical step in my mind is to escalate the question to someone who can actually help resolve the problem.

#9 IFooBar   Members   -  Reputation: 906

Like
0Likes
Like

Posted 25 August 2011 - 01:56 AM


Why are you asking us? If you've found a reproducible bug in the VC++ compiler, why not ask Microsoft?

Because most people who think they've found a compiler bug are mistaken, and this is a decent place for finding corrections in bad code?


Exactly... Was looking for someone to just confirm that the code should compile. Rather get some people I trust to confirm it. And this is probably my most trustable forum. And it's pretty interesting behaviour from vc as well.
Just wish some people wouldn't nit pick.

#10 ApochPiQ   Moderators   -  Reputation: 16386

Like
1Likes
Like

Posted 25 August 2011 - 02:41 AM

So sue me for trying to help you get in touch with someone who could give you an authoritative answer Posted Image

#11 mrbastard   Members   -  Reputation: 1573

Like
1Likes
Like

Posted 25 August 2011 - 04:58 AM

So sue me for trying to help you get in touch with someone who could give you an authoritative answer Posted Image


Move away from the keyboard and go have some fun.


#12 Antheus   Members   -  Reputation: 2397

Like
0Likes
Like

Posted 25 August 2011 - 07:26 AM

The text editor seems to be completely messed up, it just implodes on quotes, sources and everything.

Put __declspec in front of A and B as well.

#13 SiCrane   Moderators   -  Reputation: 9662

Like
0Likes
Like

Posted 25 August 2011 - 09:11 AM

Just wish some people wouldn't nit pick.

Bug in visual c++ 2010 with standard conforming code.

This a moronic claim; calling you on that isn't a nitpick. First off you claim that the code that you used was the same, and then admit that you did in fact use different code on the different compilers. It's a severe logic error that different code on a different compiler is supposed to tell you how vendor specific code on another compiler is supposed to work to the extent that you claim that it's a bug in their compiler. Furthermore, you obviously don't understand what the standard is and is supposed to do. If you don't want to learn, fine, but don't try to claim that your misused terminology isn't to blame for communication problems. If you want discussion to focus on your code, then don't aggressively claim that the first place people should be looking is for standards compliance problems in a compiler implementation. Instead of claiming up front that this code should work and it's a bug in the compiler that it doesn't, simply say the code doesn't work and ask why.

Basically saying "Way to miss the point" when you made it abundantly clear that you thought the problem was standards compliance is just acting like a dick. And then trivializing your communications errors as other people nitpicking continues that trend. Rate --.

#14 djofdifjpodjfpodkpofdpofpd   Members   -  Reputation: 120

Like
2Likes
Like

Posted 25 August 2011 - 09:16 AM

https://connect.micr...ember-functions

Issue created on connect, it would have been nice if the OP updated the post to reflect this.

#15 IFooBar   Members   -  Reputation: 906

Like
-3Likes
Like

Posted 25 August 2011 - 04:42 PM

Put __declspec in front of A and B as well.


Yeah it works then (also just if you put it in front of B), but then it produces compiler errors somewhere else. Only solution right now is to make wrappers.

Issue created on connect, it would have been nice if the OP updated the post to reflect this.


Aw common dude. I just saw that MS acknowledged my feedback!! I was not monitoring that thing 24/7 you know... :/ And I was not going to post here that the issue was posted there before I was sure it was actually something solid. But yeah it turns out it's a bug in VC and it'll be resolved in the next version. It would be interesting to see what was going wrong on the backend though.

Ok, now for that mod dude...

This a moronic claim; calling you on that isn't a nitpick. First off you claim that the code that you used was the same, and then admit that you did in fact use different code on the different compilers. It's a severe logic error that different code on a different compiler is supposed to tell you how vendor specific code on another compiler is supposed to work to the extent that you claim that it's a bug in their compiler. Furthermore, you obviously don't understand what the standard is and is supposed to do. If you don't want to learn, fine, but don't try to claim that your misused terminology isn't to blame for communication problems. If you want discussion to focus on your code, then don't aggressively claim that the first place people should be looking is for standards compliance problems in a compiler implementation. Instead of claiming up front that this code should work and it's a bug in the compiler that it doesn't, simply say the code doesn't work and ask why.

Basically saying "Way to miss the point" when you made it abundantly clear that you thought the problem was standards compliance is just acting like a dick. And then trivializing your communications errors as other people nitpicking continues that trend. Rate --.



Wow that's amazing, I love how you take15 words from a 200 word post of mine and choose to highlight 5 words that completely work against me. Completely! Impressive. Though, the other part of the title which you conveniently ignore reads bug in visual studio 2010. Which also makes it abundantly clear that I thought the problem was in MSVC, not in the code, but since I wasn't a 100% sure, I posted here.

Claim? Admit? What? Are we in a court room? I'm not claiming anything (aggressively or otherwise). I was just asking if the code is supposed to produce an error or not. I assumed people would know that you create libraries in different ways depending on the platform - maybe because I don't assume people are morons (as you so eloquently put it). So when I said standard conforming code I was implicitly referring to the actual c++ code (which declspec is not a part of) and wondering if there was anything wrong with it.

I can tell from your tone that you're one of those guys who thinks they're always right, but chill out will ya, and do something productive instead of chucking around insults. If you don't mind, I'm going skip the part where I provide a retort to you calling me a dick and a moron since someone has to keep things civil.



#16 mhagain   Crossbones+   -  Reputation: 8275

Like
1Likes
Like

Posted 25 August 2011 - 07:17 PM

Chill. ;)

There is enough meaningful negativity about Windows and how things work (or don't) with MS tools. In fairness you must admit that your original post could have come across as one of those.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#17 djofdifjpodjfpodkpofdpofpd   Members   -  Reputation: 120

Like
0Likes
Like

Posted 26 August 2011 - 06:59 AM

Aw common dude. I just saw that MS acknowledged my feedback!! I was not monitoring that thing 24/7 you know... :/ And I was not going to post here that the issue was posted there before I was sure it was actually something solid. But yeah it turns out it's a bug in VC and it'll be resolved in the next version. It would be interesting to see what was going wrong on the backend though.


FYI the bug report had not been acknowledged as a bug when I added that link. What I am saying is that people suggested to file a bug report and instead of wasting peoples time (as the issue was being looked at by MS) then to state this is what you did. By linking to that report if also allows potential future viewers to see what the outcome was.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS