Compiler crash - by Knowing me knowing you, a-ha

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 623481 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 11/20/2010 1:05:24 PM
Access Restriction Public


Run attached to this message project and compiler will crash.
Sign in to post a comment.
Posted by Ulzii [MSFT] on 1/4/2011 at 2:49 PM

Thank you for reporting this bug. We have fixed the bug and it will be available in the next major version update of Visual Studio.

Ulzii Luvsanbat
Windows C++ Team
Posted by Knowing me knowing you, a-ha on 12/17/2010 at 3:16 AM
Hi Smile,
are you (by resolving this issue as "by desing") trying to tell me that VS compiler is desing in a fashion that crashes when code isn't written according to the standard? Because in your last post you didn't answer to that question.
Posted by Smile [MSFT] on 12/14/2010 at 2:43 PM
Sure Arthur, I agree we can have more meaningful error messages.

Thanks for your further follow-up and we'll absolutely take your opinion into consideration when working on the error reporting of next generation of Visual Studio.

Smile Wei
VC++ FE Team
Posted by Knowing me knowing you, a-ha on 12/11/2010 at 9:01 AM
Hi Smile,
Yes of course I do agree that passing real numbers isn't ok according to the standard but non the less: compiler shouldn't crash. I don't expect you to tell me that this compiler is design in a way that crashes when parses non-standard conforming code? It should produce some meaningful error message, but definitely it shouldn't crash. I hope you agree on that with me.
Posted by Smile [MSFT] on 12/10/2010 at 3:31 PM
Hi Arthur,

Thanks for the follow up.

The major defect in your original code was not the explicit type usage in template declaration, but the violation of a C++ standard -- passing constant value to nontype template argument list, the const has to have external storage. Pure numbers (like 1.5) don't have external storage, that was why the compiler failed. What I changed was to define global variables wrapping up those numbers to provide them external storage, and after that the compiler passed. The compiler is designed this way to conform to this C++ standard.

Smile Wei
VC++ Front End Team
Posted by Knowing me knowing you, a-ha on 12/10/2010 at 1:38 AM
Hi Smile Wei,
Thank you for your reply. Yes I do agree that passing explicitly constant values as a template parameters isn't typical but it can happen. Therefore if what I've did in my original example is a valid C++ code this item shouldn't have fixed batch. Why? Because the error (bug in compiler) still exists. It hasn't been fixed.
Thank you.
Posted by Smile [MSFT] on 12/9/2010 at 2:07 PM
Hi Arthur,

The original compiler failure was because your template parameters were declared as const values, therefore simple numbers didn't fit in template initializations. I've changed the code little bit (as attached .zip file) and now the compilation passes.

Besides it's not typical to explicitly specify the template parameter types (like double, int...) in template declaration. Usually you want to declare them as general classes (like "class T") and specify the explicit types later in template instantiation. That way one template can be shared by multiple template instantiations with different types. In the attached .zip I added an example AllocFactor1 to demonstrate this.

Smile Wei
VC++ Front End Team
Posted by Microsoft on 11/21/2010 at 6:20 PM
Posted by Microsoft on 11/19/2010 at 9:23 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(