Bug in visual c++ 2010 with standard conforming code.
#1 Members - Reputation: 903
Posted 24 August 2011 - 04:12 PM
[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.
#4 Members - Reputation: 903
Posted 24 August 2011 - 05:18 PM
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 Moderators - Reputation: 7668
Posted 24 August 2011 - 06:10 PM
[Work - ArenaNet] [Epoch Language] [Scribblings] [Journal - peek into my shattered mind]
#6 Moderators - Reputation: 13576
Posted 24 August 2011 - 06:34 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?Why are you asking us? If you've found a reproducible bug in the VC++ compiler, why not ask Microsoft?
#7 Members - Reputation: 3828
Posted 24 August 2011 - 07:03 PM
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 Moderators - Reputation: 7668
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.
[Work - ArenaNet] [Epoch Language] [Scribblings] [Journal - peek into my shattered mind]
#9 Members - Reputation: 903
Posted 25 August 2011 - 01:56 AM
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?
Why are you asking us? If you've found a reproducible bug in the VC++ compiler, why not ask Microsoft?
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 Moderators - Reputation: 7668
Posted 25 August 2011 - 02:41 AM
[Work - ArenaNet] [Epoch Language] [Scribblings] [Journal - peek into my shattered mind]
#13 Moderators - Reputation: 6663
Posted 25 August 2011 - 09:11 AM
Just wish some people wouldn't nit pick.
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.Bug in visual c++ 2010 with standard conforming code.
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 Members - Reputation: 120
Posted 25 August 2011 - 09:16 AM
Issue created on connect, it would have been nice if the OP updated the post to reflect this.
#15 Members - Reputation: 903
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 Members - Reputation: 3828
Posted 25 August 2011 - 07:17 PM
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 Members - Reputation: 120
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.






