Jump to content

  • Log In with Google      Sign In   
  • Create Account

Microsoft (R) Optimizing Compiler Has Stopped Working


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
4 replies to this topic

#1 KingofNoobs   Members   -  Reputation: 301

Like
0Likes
Like

Posted 18 November 2012 - 10:28 AM

Hello,

I have just received the error in the title when trying to compile the following code

auto ExtractString = [&](string& dest, char source, FileSection& currentFileSection, FileSection nextFileSection = END_OF_HEADER)
{ ... };

Just for context, I am writing a custom file format parser.

Am I just hosed here, or is there some way to work around a broken compiler?

Thanks and best,

Dave

I wonder as I wander...

http://www.davesgameoflife.com


Sponsor:

#2 Nik02   Crossbones+   -  Reputation: 2918

Like
0Likes
Like

Posted 19 November 2012 - 01:46 AM

Check your lambda capture syntax (the [&] stuff).

Alternatively, use a conventional function (and its pointer) in place of the lambda expression.

Niko Suni


#3 rip-off   Moderators   -  Reputation: 8727

Like
2Likes
Like

Posted 19 November 2012 - 02:34 AM

What is the minimal source file that reproduces the error?

For example, I get "error C3486: a parameter for a lambda cannot have a default argument" with the following code:
#include <string>

using std::string;

enum FileSection {
	START_OF_HEADER,
	END_OF_HEADER
};

int main() {
	auto ExtractString = [&](string& dest, char source, FileSection& currentFileSection, FileSection nextFileSection = END_OF_HEADER) {
	};
	std::string string;
	FileSection current = START_OF_HEADER;
	ExtractString(string, 'a', current);
}
Some light Googling suggests this is actually compliant with the standard and not an incomplete implementation.

It would be interesting to know what changes you have to make to generate the crash. Even if it is not legal code, it shouldn't crash the compiler so you should look into reporting this.

#4 BitMaster   Crossbones+   -  Reputation: 4432

Like
0Likes
Like

Posted 19 November 2012 - 02:43 AM

While I have found sporadically code that could crash an MSVC compiler in practically every instance it was rather clear that the code was wrong and needed to be fixed anyway (admittedly, that would have been easier with a proper error message).

That said, such cases have always been extremely rare for me. Infrequently the compiler crashes, but usually that is fixed by just trying again or doing a clean first. There was one instance where I had to manually (clean or rebuild explicitly did not do the job) delete all intermediate files to get things working again, but that was back in MSVC 2003.

#5 Khatharr   Crossbones+   -  Reputation: 3039

Like
0Likes
Like

Posted 19 November 2012 - 06:32 PM

Yeah, I tanked it once myself, though now I can't remember what it was I did. (It was something really crazy that came out of a typo.)

I just remember laughing for about 10 minutes about it.

Your compiler is fine. It's just a microsoft product.

Edited by Khatharr, 19 November 2012 - 06:34 PM.

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.




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